backup 2026-08-23T20:24:25.191693 (part 3)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .opencode/node_modules/effect/dist/Graph.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Graph.js +593 -274
- .opencode/node_modules/effect/dist/Graph.js.map +0 -0
- .opencode/node_modules/effect/dist/HKT.d.ts +72 -64
- .opencode/node_modules/effect/dist/HKT.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Hash.d.ts +162 -51
- .opencode/node_modules/effect/dist/Hash.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Hash.js +131 -43
- .opencode/node_modules/effect/dist/Hash.js.map +1 -1
- .opencode/node_modules/effect/dist/HashMap.d.ts +573 -430
- .opencode/node_modules/effect/dist/HashMap.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/HashMap.js +230 -170
- .opencode/node_modules/effect/dist/HashMap.js.map +1 -1
- .opencode/node_modules/effect/dist/HashRing.d.ts +267 -43
- .opencode/node_modules/effect/dist/HashRing.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/HashRing.js +130 -21
- .opencode/node_modules/effect/dist/HashRing.js.map +1 -1
- .opencode/node_modules/effect/dist/HashSet.d.ts +229 -170
- .opencode/node_modules/effect/dist/HashSet.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/HashSet.js +87 -62
- .opencode/node_modules/effect/dist/HashSet.js.map +1 -1
- .opencode/node_modules/effect/dist/Inspectable.d.ts +86 -17
- .opencode/node_modules/effect/dist/Inspectable.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Inspectable.js +68 -44
- .opencode/node_modules/effect/dist/Inspectable.js.map +1 -1
- .opencode/node_modules/effect/dist/Iterable.d.ts +692 -349
- .opencode/node_modules/effect/dist/Iterable.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Iterable.js +290 -165
- .opencode/node_modules/effect/dist/Iterable.js.map +1 -1
- .opencode/node_modules/effect/dist/JsonPatch.d.ts +84 -86
- .opencode/node_modules/effect/dist/JsonPatch.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/JsonPatch.js +43 -93
- .opencode/node_modules/effect/dist/JsonPatch.js.map +1 -1
- .opencode/node_modules/effect/dist/JsonPointer.d.ts +34 -85
- .opencode/node_modules/effect/dist/JsonPointer.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/JsonPointer.js +34 -85
- .opencode/node_modules/effect/dist/JsonPointer.js.map +1 -1
- .opencode/node_modules/effect/dist/JsonSchema.d.ts +193 -79
- .opencode/node_modules/effect/dist/JsonSchema.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/JsonSchema.js +135 -141
- .opencode/node_modules/effect/dist/JsonSchema.js.map +1 -1
- .opencode/node_modules/effect/dist/Latch.d.ts +248 -31
- .opencode/node_modules/effect/dist/Latch.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Latch.js +133 -18
- .opencode/node_modules/effect/dist/Latch.js.map +1 -1
- .opencode/node_modules/effect/dist/Layer.d.ts +0 -0
- .opencode/node_modules/effect/dist/Layer.d.ts.map +1 -1
- .opencode/node_modules/effect/dist/Layer.js +662 -353
- .opencode/node_modules/effect/dist/Layer.js.map +1 -1
- .opencode/node_modules/effect/dist/LayerMap.d.ts +82 -27
.opencode/node_modules/effect/dist/Graph.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Graph.d.ts","sourceRoot":"","sources":["../src/Graph.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAGnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,QAAA,MAAM,MAAM,8BAA8B,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,C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,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;CAmC3H,CAAA"}
|
.opencode/node_modules/effect/dist/Graph.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 4.0.0
|
| 3 |
*/
|
| 4 |
import * as Data from "./Data.js";
|
|
@@ -11,10 +18,19 @@ import { pipeArguments } from "./Pipeable.js";
|
|
| 11 |
import { hasProperty } from "./Predicate.js";
|
| 12 |
const TypeId = "~effect/collections/Graph";
|
| 13 |
/**
|
| 14 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
*
|
| 16 |
-
* @since 4.0.0
|
| 17 |
* @category models
|
|
|
|
| 18 |
*/
|
| 19 |
export class Edge extends Data.Class {}
|
| 20 |
// =============================================================================
|
|
@@ -91,8 +107,17 @@ const ProtoGraph = {
|
|
| 91 |
// =============================================================================
|
| 92 |
// TODO: Do we need safe variants for these?
|
| 93 |
/**
|
| 94 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
* @category errors
|
|
|
|
| 96 |
*/
|
| 97 |
export class GraphError extends /*#__PURE__*/Data.TaggedError("GraphError") {}
|
| 98 |
/** @internal */
|
|
@@ -103,14 +128,27 @@ const missingNode = node => new GraphError({
|
|
| 103 |
// Constructors
|
| 104 |
// =============================================================================
|
| 105 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
* @since 4.0.0
|
| 107 |
-
* @category Guards
|
| 108 |
*/
|
| 109 |
export const isGraph = u => hasProperty(u, TypeId);
|
| 110 |
/**
|
| 111 |
* Creates a directed graph, optionally with initial mutations.
|
| 112 |
*
|
| 113 |
-
*
|
|
|
|
| 114 |
* ```ts
|
| 115 |
* import { Graph } from "effect"
|
| 116 |
*
|
|
@@ -124,8 +162,8 @@ export const isGraph = u => hasProperty(u, TypeId);
|
|
| 124 |
* })
|
| 125 |
* ```
|
| 126 |
*
|
| 127 |
-
* @since 4.0.0
|
| 128 |
* @category constructors
|
|
|
|
| 129 |
*/
|
| 130 |
export const directed = mutate => {
|
| 131 |
const graph = Object.create(ProtoGraph);
|
|
@@ -148,7 +186,8 @@ export const directed = mutate => {
|
|
| 148 |
/**
|
| 149 |
* Creates an undirected graph, optionally with initial mutations.
|
| 150 |
*
|
| 151 |
-
*
|
|
|
|
| 152 |
* ```ts
|
| 153 |
* import { Graph } from "effect"
|
| 154 |
*
|
|
@@ -162,8 +201,8 @@ export const directed = mutate => {
|
|
| 162 |
* })
|
| 163 |
* ```
|
| 164 |
*
|
| 165 |
-
* @since 4.0.0
|
| 166 |
* @category constructors
|
|
|
|
| 167 |
*/
|
| 168 |
export const undirected = mutate => {
|
| 169 |
const graph = Object.create(ProtoGraph);
|
|
@@ -189,7 +228,8 @@ export const undirected = mutate => {
|
|
| 189 |
/**
|
| 190 |
* Creates a mutable scope for safe graph mutations by copying the data structure.
|
| 191 |
*
|
| 192 |
-
*
|
|
|
|
| 193 |
* ```ts
|
| 194 |
* import { Graph } from "effect"
|
| 195 |
*
|
|
@@ -198,8 +238,8 @@ export const undirected = mutate => {
|
|
| 198 |
* // Now mutable can be safely modified without affecting original graph
|
| 199 |
* ```
|
| 200 |
*
|
| 201 |
-
* @since 4.0.0
|
| 202 |
* @category mutations
|
|
|
|
| 203 |
*/
|
| 204 |
export const beginMutation = graph => {
|
| 205 |
// Copy adjacency maps with deep cloned arrays
|
|
@@ -226,7 +266,8 @@ export const beginMutation = graph => {
|
|
| 226 |
/**
|
| 227 |
* Converts a mutable graph back to an immutable graph, ending the mutation scope.
|
| 228 |
*
|
| 229 |
-
*
|
|
|
|
| 230 |
* ```ts
|
| 231 |
* import { Graph } from "effect"
|
| 232 |
*
|
|
@@ -236,8 +277,8 @@ export const beginMutation = graph => {
|
|
| 236 |
* const newGraph = Graph.endMutation(mutable)
|
| 237 |
* ```
|
| 238 |
*
|
| 239 |
-
* @since 4.0.0
|
| 240 |
* @category mutations
|
|
|
|
| 241 |
*/
|
| 242 |
export const endMutation = mutable => {
|
| 243 |
const graph = Object.create(ProtoGraph);
|
|
@@ -255,19 +296,24 @@ export const endMutation = mutable => {
|
|
| 255 |
/**
|
| 256 |
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
| 257 |
*
|
| 258 |
-
*
|
|
|
|
| 259 |
* ```ts
|
| 260 |
* import { Graph } from "effect"
|
| 261 |
*
|
| 262 |
* const graph = Graph.directed<string, number>()
|
| 263 |
* const newGraph = Graph.mutate(graph, (mutable) => {
|
| 264 |
-
*
|
| 265 |
-
*
|
|
|
|
| 266 |
* })
|
|
|
|
|
|
|
|
|
|
| 267 |
* ```
|
| 268 |
*
|
| 269 |
-
* @since 4.0.0
|
| 270 |
* @category mutations
|
|
|
|
| 271 |
*/
|
| 272 |
export const mutate = /*#__PURE__*/dual(2, (graph, f) => {
|
| 273 |
const mutable = beginMutation(graph);
|
|
@@ -280,7 +326,23 @@ export const mutate = /*#__PURE__*/dual(2, (graph, f) => {
|
|
| 280 |
/**
|
| 281 |
* Adds a new node to a mutable graph and returns its index.
|
| 282 |
*
|
| 283 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
* ```ts
|
| 285 |
* import { Graph } from "effect"
|
| 286 |
*
|
|
@@ -292,8 +354,12 @@ export const mutate = /*#__PURE__*/dual(2, (graph, f) => {
|
|
| 292 |
* })
|
| 293 |
* ```
|
| 294 |
*
|
| 295 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 296 |
* @category mutations
|
|
|
|
| 297 |
*/
|
| 298 |
export const addNode = (mutable, data) => {
|
| 299 |
const nodeIndex = mutable.nextNodeIndex;
|
|
@@ -307,12 +373,12 @@ export const addNode = (mutable, data) => {
|
|
| 307 |
return nodeIndex;
|
| 308 |
};
|
| 309 |
/**
|
| 310 |
-
* Gets the data associated with a node index, if it exists.
|
|
|
|
|
|
|
| 311 |
*
|
| 312 |
-
* @example
|
| 313 |
* ```ts
|
| 314 |
-
* import { Graph } from "effect"
|
| 315 |
-
* import * as Option from "effect/Option"
|
| 316 |
*
|
| 317 |
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
| 318 |
* Graph.addNode(mutable, "Node A")
|
|
@@ -326,14 +392,15 @@ export const addNode = (mutable, data) => {
|
|
| 326 |
* }
|
| 327 |
* ```
|
| 328 |
*
|
| 329 |
-
* @since 4.0.0
|
| 330 |
* @category getters
|
|
|
|
| 331 |
*/
|
| 332 |
export const getNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.has(nodeIndex) ? Option.some(graph.nodes.get(nodeIndex)) : Option.none());
|
| 333 |
/**
|
| 334 |
-
* Checks
|
|
|
|
|
|
|
| 335 |
*
|
| 336 |
-
* @example
|
| 337 |
* ```ts
|
| 338 |
* import { Graph } from "effect"
|
| 339 |
*
|
|
@@ -350,14 +417,15 @@ export const getNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.ha
|
|
| 350 |
* console.log(notExists) // false
|
| 351 |
* ```
|
| 352 |
*
|
| 353 |
-
* @since 4.0.0
|
| 354 |
* @category getters
|
|
|
|
| 355 |
*/
|
| 356 |
export const hasNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.has(nodeIndex));
|
| 357 |
/**
|
| 358 |
* Returns the number of nodes in the graph.
|
| 359 |
*
|
| 360 |
-
*
|
|
|
|
| 361 |
* ```ts
|
| 362 |
* import { Graph } from "effect"
|
| 363 |
*
|
|
@@ -373,14 +441,15 @@ export const hasNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.ha
|
|
| 373 |
* console.log(Graph.nodeCount(graphWithNodes)) // 3
|
| 374 |
* ```
|
| 375 |
*
|
| 376 |
-
* @since 4.0.0
|
| 377 |
* @category getters
|
|
|
|
| 378 |
*/
|
| 379 |
export const nodeCount = graph => graph.nodes.size;
|
| 380 |
/**
|
| 381 |
* Finds the first node that matches the given predicate.
|
| 382 |
*
|
| 383 |
-
*
|
|
|
|
| 384 |
* ```ts
|
| 385 |
* import { Graph } from "effect"
|
| 386 |
*
|
|
@@ -397,8 +466,8 @@ export const nodeCount = graph => graph.nodes.size;
|
|
| 397 |
* console.log(notFound) // Option.none()
|
| 398 |
* ```
|
| 399 |
*
|
| 400 |
-
* @since 4.0.0
|
| 401 |
* @category getters
|
|
|
|
| 402 |
*/
|
| 403 |
export const findNode = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 404 |
for (const [index, data] of graph.nodes) {
|
|
@@ -411,7 +480,8 @@ export const findNode = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 411 |
/**
|
| 412 |
* Finds all nodes that match the given predicate.
|
| 413 |
*
|
| 414 |
-
*
|
|
|
|
| 415 |
* ```ts
|
| 416 |
* import { Graph } from "effect"
|
| 417 |
*
|
|
@@ -428,8 +498,8 @@ export const findNode = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 428 |
* console.log(empty) // []
|
| 429 |
* ```
|
| 430 |
*
|
| 431 |
-
* @since 4.0.0
|
| 432 |
* @category getters
|
|
|
|
| 433 |
*/
|
| 434 |
export const findNodes = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 435 |
const results = [];
|
|
@@ -443,7 +513,8 @@ export const findNodes = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 443 |
/**
|
| 444 |
* Finds the first edge that matches the given predicate.
|
| 445 |
*
|
| 446 |
-
*
|
|
|
|
| 447 |
* ```ts
|
| 448 |
* import { Graph } from "effect"
|
| 449 |
*
|
|
@@ -462,8 +533,8 @@ export const findNodes = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 462 |
* console.log(notFound) // Option.none()
|
| 463 |
* ```
|
| 464 |
*
|
| 465 |
-
* @since 4.0.0
|
| 466 |
* @category getters
|
|
|
|
| 467 |
*/
|
| 468 |
export const findEdge = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 469 |
for (const [edgeIndex, edgeData] of graph.edges) {
|
|
@@ -476,7 +547,8 @@ export const findEdge = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 476 |
/**
|
| 477 |
* Finds all edges that match the given predicate.
|
| 478 |
*
|
| 479 |
-
*
|
|
|
|
| 480 |
* ```ts
|
| 481 |
* import { Graph } from "effect"
|
| 482 |
*
|
|
@@ -496,8 +568,8 @@ export const findEdge = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 496 |
* console.log(empty) // []
|
| 497 |
* ```
|
| 498 |
*
|
| 499 |
-
* @since 4.0.0
|
| 500 |
* @category getters
|
|
|
|
| 501 |
*/
|
| 502 |
export const findEdges = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 503 |
const results = [];
|
|
@@ -511,7 +583,8 @@ export const findEdges = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 511 |
/**
|
| 512 |
* Updates a single node's data by applying a transformation function.
|
| 513 |
*
|
| 514 |
-
*
|
|
|
|
| 515 |
* ```ts
|
| 516 |
* import { Graph } from "effect"
|
| 517 |
*
|
|
@@ -525,8 +598,8 @@ export const findEdges = /*#__PURE__*/dual(2, (graph, predicate) => {
|
|
| 525 |
* console.log(nodeData) // Option.some("NODE A")
|
| 526 |
* ```
|
| 527 |
*
|
| 528 |
-
* @
|
| 529 |
-
* @
|
| 530 |
*/
|
| 531 |
export const updateNode = (mutable, index, f) => {
|
| 532 |
if (!mutable.nodes.has(index)) {
|
|
@@ -539,7 +612,8 @@ export const updateNode = (mutable, index, f) => {
|
|
| 539 |
/**
|
| 540 |
* Updates a single edge's data by applying a transformation function.
|
| 541 |
*
|
| 542 |
-
*
|
|
|
|
| 543 |
* ```ts
|
| 544 |
* import { Graph } from "effect"
|
| 545 |
*
|
|
@@ -551,11 +625,11 @@ export const updateNode = (mutable, index, f) => {
|
|
| 551 |
* })
|
| 552 |
*
|
| 553 |
* const edgeData = Graph.getEdge(result, 0)
|
| 554 |
-
* console.log(edgeData) // new Graph.Edge({ source: 0, target: 1, data: 20 })
|
| 555 |
* ```
|
| 556 |
*
|
| 557 |
-
* @since 4.0.0
|
| 558 |
* @category mutations
|
|
|
|
| 559 |
*/
|
| 560 |
export const updateEdge = (mutable, edgeIndex, f) => {
|
| 561 |
if (!mutable.edges.has(edgeIndex)) {
|
|
@@ -569,9 +643,15 @@ export const updateEdge = (mutable, edgeIndex, f) => {
|
|
| 569 |
}));
|
| 570 |
};
|
| 571 |
/**
|
| 572 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
*
|
| 574 |
-
* @example
|
| 575 |
* ```ts
|
| 576 |
* import { Graph } from "effect"
|
| 577 |
*
|
|
@@ -583,11 +663,11 @@ export const updateEdge = (mutable, edgeIndex, f) => {
|
|
| 583 |
* })
|
| 584 |
*
|
| 585 |
* const nodeData = Graph.getNode(graph, 0)
|
| 586 |
-
* console.log(nodeData) //
|
| 587 |
* ```
|
| 588 |
*
|
| 589 |
-
* @
|
| 590 |
-
* @
|
| 591 |
*/
|
| 592 |
export const mapNodes = (mutable, f) => {
|
| 593 |
// Transform existing node data in place
|
|
@@ -599,7 +679,8 @@ export const mapNodes = (mutable, f) => {
|
|
| 599 |
/**
|
| 600 |
* Transforms all edge data in a mutable graph using the provided mapping function.
|
| 601 |
*
|
| 602 |
-
*
|
|
|
|
| 603 |
* ```ts
|
| 604 |
* import { Graph } from "effect"
|
| 605 |
*
|
|
@@ -613,11 +694,11 @@ export const mapNodes = (mutable, f) => {
|
|
| 613 |
* })
|
| 614 |
*
|
| 615 |
* const edgeData = Graph.getEdge(graph, 0)
|
| 616 |
-
* console.log(edgeData) // new Graph.Edge({ source: 0, target: 1, data: 20 })
|
| 617 |
* ```
|
| 618 |
*
|
| 619 |
-
* @
|
| 620 |
-
* @
|
| 621 |
*/
|
| 622 |
export const mapEdges = (mutable, f) => {
|
| 623 |
// Transform existing edge data in place
|
|
@@ -630,9 +711,29 @@ export const mapEdges = (mutable, f) => {
|
|
| 630 |
}
|
| 631 |
};
|
| 632 |
/**
|
| 633 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
*
|
| 635 |
-
* @example
|
| 636 |
* ```ts
|
| 637 |
* import { Graph } from "effect"
|
| 638 |
*
|
|
@@ -646,13 +747,16 @@ export const mapEdges = (mutable, f) => {
|
|
| 646 |
* })
|
| 647 |
*
|
| 648 |
* const edge0 = Graph.getEdge(graph, 0)
|
| 649 |
-
* console.log(edge0) // new Graph.Edge({ source: 1, target: 0, data: 1 })
|
| 650 |
* ```
|
| 651 |
*
|
| 652 |
-
* @
|
| 653 |
-
* @
|
| 654 |
*/
|
| 655 |
export const reverse = mutable => {
|
|
|
|
|
|
|
|
|
|
| 656 |
// Reverse all edges by swapping source and target
|
| 657 |
for (const [index, edgeData] of mutable.edges) {
|
| 658 |
mutable.edges.set(index, new Edge({
|
|
@@ -661,20 +765,7 @@ export const reverse = mutable => {
|
|
| 661 |
data: edgeData.data
|
| 662 |
}));
|
| 663 |
}
|
| 664 |
-
|
| 665 |
-
mutable.adjacency.clear();
|
| 666 |
-
mutable.reverseAdjacency.clear();
|
| 667 |
-
// Rebuild adjacency lists with reversed directions
|
| 668 |
-
for (const [edgeIndex, edgeData] of mutable.edges) {
|
| 669 |
-
// Add to forward adjacency (source -> target)
|
| 670 |
-
const sourceEdges = mutable.adjacency.get(edgeData.source) || [];
|
| 671 |
-
sourceEdges.push(edgeIndex);
|
| 672 |
-
mutable.adjacency.set(edgeData.source, sourceEdges);
|
| 673 |
-
// Add to reverse adjacency (target <- source)
|
| 674 |
-
const targetEdges = mutable.reverseAdjacency.get(edgeData.target) || [];
|
| 675 |
-
targetEdges.push(edgeIndex);
|
| 676 |
-
mutable.reverseAdjacency.set(edgeData.target, targetEdges);
|
| 677 |
-
}
|
| 678 |
// Invalidate cycle flag since edge directions changed
|
| 679 |
mutable.acyclic = Option.none();
|
| 680 |
};
|
|
@@ -682,10 +773,10 @@ export const reverse = mutable => {
|
|
| 682 |
* Filters and optionally transforms nodes in a mutable graph using a predicate function.
|
| 683 |
* Nodes that return Option.none are removed along with all their connected edges.
|
| 684 |
*
|
| 685 |
-
*
|
|
|
|
| 686 |
* ```ts
|
| 687 |
-
* import { Graph } from "effect"
|
| 688 |
-
* import * as Option from "effect/Option"
|
| 689 |
*
|
| 690 |
* const graph = Graph.directed<string, number>((mutable) => {
|
| 691 |
* const a = Graph.addNode(mutable, "active")
|
|
@@ -705,8 +796,8 @@ export const reverse = mutable => {
|
|
| 705 |
* console.log(Graph.nodeCount(graph)) // 2 (only "active" nodes remain)
|
| 706 |
* ```
|
| 707 |
*
|
| 708 |
-
* @
|
| 709 |
-
* @
|
| 710 |
*/
|
| 711 |
export const filterMapNodes = (mutable, f) => {
|
| 712 |
const nodesToRemove = [];
|
|
@@ -730,10 +821,10 @@ export const filterMapNodes = (mutable, f) => {
|
|
| 730 |
* Filters and optionally transforms edges in a mutable graph using a predicate function.
|
| 731 |
* Edges that return Option.none are removed from the graph.
|
| 732 |
*
|
| 733 |
-
*
|
|
|
|
| 734 |
* ```ts
|
| 735 |
-
* import { Graph } from "effect"
|
| 736 |
-
* import * as Option from "effect/Option"
|
| 737 |
*
|
| 738 |
* const graph = Graph.directed<string, number>((mutable) => {
|
| 739 |
* const a = Graph.addNode(mutable, "A")
|
|
@@ -753,8 +844,8 @@ export const filterMapNodes = (mutable, f) => {
|
|
| 753 |
* console.log(Graph.edgeCount(graph)) // 2 (edges with weight 5 removed)
|
| 754 |
* ```
|
| 755 |
*
|
| 756 |
-
* @
|
| 757 |
-
* @
|
| 758 |
*/
|
| 759 |
export const filterMapEdges = (mutable, f) => {
|
| 760 |
const edgesToRemove = [];
|
|
@@ -781,7 +872,8 @@ export const filterMapEdges = (mutable, f) => {
|
|
| 781 |
* Filters nodes by removing those that don't match the predicate.
|
| 782 |
* This function modifies the mutable graph in place.
|
| 783 |
*
|
| 784 |
-
*
|
|
|
|
| 785 |
* ```ts
|
| 786 |
* import { Graph } from "effect"
|
| 787 |
*
|
|
@@ -798,8 +890,8 @@ export const filterMapEdges = (mutable, f) => {
|
|
| 798 |
* console.log(Graph.nodeCount(graph)) // 2 (only "active" nodes remain)
|
| 799 |
* ```
|
| 800 |
*
|
| 801 |
-
* @
|
| 802 |
-
* @
|
| 803 |
*/
|
| 804 |
export const filterNodes = (mutable, predicate) => {
|
| 805 |
const nodesToRemove = [];
|
|
@@ -818,7 +910,8 @@ export const filterNodes = (mutable, predicate) => {
|
|
| 818 |
* Filters edges by removing those that don't match the predicate.
|
| 819 |
* This function modifies the mutable graph in place.
|
| 820 |
*
|
| 821 |
-
*
|
|
|
|
| 822 |
* ```ts
|
| 823 |
* import { Graph } from "effect"
|
| 824 |
*
|
|
@@ -838,8 +931,8 @@ export const filterNodes = (mutable, predicate) => {
|
|
| 838 |
* console.log(Graph.edgeCount(graph)) // 2 (edge with weight 5 removed)
|
| 839 |
* ```
|
| 840 |
*
|
| 841 |
-
* @
|
| 842 |
-
* @
|
| 843 |
*/
|
| 844 |
export const filterEdges = (mutable, predicate) => {
|
| 845 |
const edgesToRemove = [];
|
|
@@ -877,7 +970,24 @@ const invalidateCycleFlagOnAddition = mutable => {
|
|
| 877 |
/**
|
| 878 |
* Adds a new edge to a mutable graph and returns its index.
|
| 879 |
*
|
| 880 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 881 |
* ```ts
|
| 882 |
* import { Graph } from "effect"
|
| 883 |
*
|
|
@@ -889,8 +999,13 @@ const invalidateCycleFlagOnAddition = mutable => {
|
|
| 889 |
* })
|
| 890 |
* ```
|
| 891 |
*
|
| 892 |
-
* @
|
|
|
|
|
|
|
|
|
|
|
|
|
| 893 |
* @category mutations
|
|
|
|
| 894 |
*/
|
| 895 |
export const addEdge = (mutable, source, target, data) => {
|
| 896 |
// Validate that both nodes exist
|
|
@@ -938,7 +1053,8 @@ export const addEdge = (mutable, source, target, data) => {
|
|
| 938 |
/**
|
| 939 |
* Removes a node and all its incident edges from a mutable graph.
|
| 940 |
*
|
| 941 |
-
*
|
|
|
|
| 942 |
* ```ts
|
| 943 |
* import { Graph } from "effect"
|
| 944 |
*
|
|
@@ -952,8 +1068,8 @@ export const addEdge = (mutable, source, target, data) => {
|
|
| 952 |
* })
|
| 953 |
* ```
|
| 954 |
*
|
| 955 |
-
* @since 4.0.0
|
| 956 |
* @category mutations
|
|
|
|
| 957 |
*/
|
| 958 |
export const removeNode = (mutable, nodeIndex) => {
|
| 959 |
// Check if node exists
|
|
@@ -991,7 +1107,8 @@ export const removeNode = (mutable, nodeIndex) => {
|
|
| 991 |
/**
|
| 992 |
* Removes an edge from a mutable graph.
|
| 993 |
*
|
| 994 |
-
*
|
|
|
|
| 995 |
* ```ts
|
| 996 |
* import { Graph } from "effect"
|
| 997 |
*
|
|
@@ -1005,8 +1122,8 @@ export const removeNode = (mutable, nodeIndex) => {
|
|
| 1005 |
* })
|
| 1006 |
* ```
|
| 1007 |
*
|
| 1008 |
-
* @since 4.0.0
|
| 1009 |
* @category mutations
|
|
|
|
| 1010 |
*/
|
| 1011 |
export const removeEdge = (mutable, edgeIndex) => {
|
| 1012 |
const wasRemoved = removeEdgeInternal(mutable, edgeIndex);
|
|
@@ -1067,9 +1184,10 @@ const removeEdgeInternal = (mutable, edgeIndex) => {
|
|
| 1067 |
// Edge Query Operations
|
| 1068 |
// =============================================================================
|
| 1069 |
/**
|
| 1070 |
-
* Gets the edge data associated with an edge index, if it exists.
|
|
|
|
|
|
|
| 1071 |
*
|
| 1072 |
-
* @example
|
| 1073 |
* ```ts
|
| 1074 |
* import { Graph } from "effect"
|
| 1075 |
*
|
|
@@ -1084,19 +1202,20 @@ const removeEdgeInternal = (mutable, edgeIndex) => {
|
|
| 1084 |
*
|
| 1085 |
* if (edgeData._tag === "Some") {
|
| 1086 |
* console.log(edgeData.value.data) // 42
|
| 1087 |
-
* console.log(edgeData.value.source) //
|
| 1088 |
-
* console.log(edgeData.value.target) //
|
| 1089 |
* }
|
| 1090 |
* ```
|
| 1091 |
*
|
| 1092 |
-
* @since 4.0.0
|
| 1093 |
* @category getters
|
|
|
|
| 1094 |
*/
|
| 1095 |
export const getEdge = /*#__PURE__*/dual(2, (graph, edgeIndex) => Option.fromUndefinedOr(graph.edges.get(edgeIndex)));
|
| 1096 |
/**
|
| 1097 |
-
* Checks
|
|
|
|
|
|
|
| 1098 |
*
|
| 1099 |
-
* @example
|
| 1100 |
* ```ts
|
| 1101 |
* import { Graph } from "effect"
|
| 1102 |
*
|
|
@@ -1118,8 +1237,8 @@ export const getEdge = /*#__PURE__*/dual(2, (graph, edgeIndex) => Option.fromUnd
|
|
| 1118 |
* console.log(hasAC) // false
|
| 1119 |
* ```
|
| 1120 |
*
|
| 1121 |
-
* @since 4.0.0
|
| 1122 |
* @category getters
|
|
|
|
| 1123 |
*/
|
| 1124 |
export const hasEdge = /*#__PURE__*/dual(3, (graph, source, target) => {
|
| 1125 |
const adjacencyList = graph.adjacency.get(source);
|
|
@@ -1129,8 +1248,11 @@ export const hasEdge = /*#__PURE__*/dual(3, (graph, source, target) => {
|
|
| 1129 |
// Check if any edge in the adjacency list connects to the target
|
| 1130 |
for (const edgeIndex of adjacencyList) {
|
| 1131 |
const edge = graph.edges.get(edgeIndex);
|
| 1132 |
-
if (edge !== undefined
|
| 1133 |
-
|
|
|
|
|
|
|
|
|
|
| 1134 |
}
|
| 1135 |
}
|
| 1136 |
return false;
|
|
@@ -1138,7 +1260,8 @@ export const hasEdge = /*#__PURE__*/dual(3, (graph, source, target) => {
|
|
| 1138 |
/**
|
| 1139 |
* Returns the number of edges in the graph.
|
| 1140 |
*
|
| 1141 |
-
*
|
|
|
|
| 1142 |
* ```ts
|
| 1143 |
* import { Graph } from "effect"
|
| 1144 |
*
|
|
@@ -1157,14 +1280,35 @@ export const hasEdge = /*#__PURE__*/dual(3, (graph, source, target) => {
|
|
| 1157 |
* console.log(Graph.edgeCount(graphWithEdges)) // 3
|
| 1158 |
* ```
|
| 1159 |
*
|
| 1160 |
-
* @since 4.0.0
|
| 1161 |
* @category getters
|
|
|
|
| 1162 |
*/
|
| 1163 |
export const edgeCount = graph => graph.edges.size;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1164 |
/**
|
| 1165 |
-
* Returns the neighboring
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1166 |
*
|
| 1167 |
-
* @example
|
| 1168 |
* ```ts
|
| 1169 |
* import { Graph } from "effect"
|
| 1170 |
*
|
|
@@ -1181,37 +1325,88 @@ export const edgeCount = graph => graph.edges.size;
|
|
| 1181 |
* const nodeC = 2
|
| 1182 |
*
|
| 1183 |
* const neighborsA = Graph.neighbors(graph, nodeA)
|
| 1184 |
-
* console.log(neighborsA) // [
|
| 1185 |
*
|
| 1186 |
* const neighborsB = Graph.neighbors(graph, nodeB)
|
| 1187 |
* console.log(neighborsB) // []
|
| 1188 |
* ```
|
| 1189 |
*
|
| 1190 |
-
* @since 4.0.0
|
| 1191 |
* @category getters
|
|
|
|
| 1192 |
*/
|
| 1193 |
export const neighbors = /*#__PURE__*/dual(2, (graph, nodeIndex) => {
|
| 1194 |
// For undirected graphs, use the specialized helper that returns the other endpoint
|
| 1195 |
if (graph.type === "undirected") {
|
| 1196 |
return getUndirectedNeighbors(graph, nodeIndex);
|
| 1197 |
}
|
| 1198 |
-
|
| 1199 |
-
|
| 1200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1201 |
}
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
| 1207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1208 |
}
|
| 1209 |
-
return
|
| 1210 |
});
|
| 1211 |
/**
|
| 1212 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1213 |
*
|
| 1214 |
-
* @example
|
| 1215 |
* ```ts
|
| 1216 |
* import { Graph } from "effect"
|
| 1217 |
*
|
|
@@ -1231,30 +1426,25 @@ export const neighbors = /*#__PURE__*/dual(2, (graph, nodeIndex) => {
|
|
| 1231 |
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
| 1232 |
* ```
|
| 1233 |
*
|
| 1234 |
-
* @
|
|
|
|
|
|
|
| 1235 |
* @category queries
|
|
|
|
| 1236 |
*/
|
| 1237 |
export const neighborsDirected = /*#__PURE__*/dual(3, (graph, nodeIndex, direction) => {
|
| 1238 |
-
|
| 1239 |
-
|
| 1240 |
-
|
| 1241 |
-
|
| 1242 |
-
}
|
| 1243 |
-
const result = [];
|
| 1244 |
-
for (const edgeIndex of adjacencyList) {
|
| 1245 |
-
const edge = graph.edges.get(edgeIndex);
|
| 1246 |
-
if (edge !== undefined) {
|
| 1247 |
-
// For incoming direction, we want the source node instead of target
|
| 1248 |
-
const neighborNode = direction === "incoming" ? edge.source : edge.target;
|
| 1249 |
-
result.push(neighborNode);
|
| 1250 |
-
}
|
| 1251 |
}
|
| 1252 |
-
return
|
| 1253 |
});
|
| 1254 |
/**
|
| 1255 |
* Exports a graph to GraphViz DOT format for visualization.
|
| 1256 |
*
|
| 1257 |
-
*
|
|
|
|
| 1258 |
* ```ts
|
| 1259 |
* import { Graph } from "effect"
|
| 1260 |
*
|
|
@@ -1279,8 +1469,8 @@ export const neighborsDirected = /*#__PURE__*/dual(3, (graph, nodeIndex, directi
|
|
| 1279 |
* // }
|
| 1280 |
* ```
|
| 1281 |
*
|
| 1282 |
-
* @
|
| 1283 |
-
* @
|
| 1284 |
*/
|
| 1285 |
export const toGraphViz = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, options) => {
|
| 1286 |
const {
|
|
@@ -1343,14 +1533,17 @@ const formatMermaidNode = (nodeId, label, shape) => {
|
|
| 1343 |
/**
|
| 1344 |
* Exports a graph to Mermaid diagram format for visualization.
|
| 1345 |
*
|
|
|
|
|
|
|
| 1346 |
* Mermaid is a popular diagram-as-code tool that generates flowcharts and other
|
| 1347 |
* visualizations from text-based definitions. This function converts Effect Graph
|
| 1348 |
* structures to valid Mermaid syntax for use in documentation, web applications,
|
| 1349 |
* and visualization tools.
|
| 1350 |
*
|
| 1351 |
-
*
|
|
|
|
| 1352 |
* ```ts
|
| 1353 |
-
* import
|
| 1354 |
*
|
| 1355 |
* // Basic directed graph export
|
| 1356 |
* const graph = Graph.directed<string, number>((mutable) => {
|
|
@@ -1371,9 +1564,10 @@ const formatMermaidNode = (nodeId, label, shape) => {
|
|
| 1371 |
* // 0 -->|"2"| 2
|
| 1372 |
* ```
|
| 1373 |
*
|
| 1374 |
-
*
|
|
|
|
| 1375 |
* ```ts
|
| 1376 |
-
* import
|
| 1377 |
*
|
| 1378 |
* // Undirected graph with custom labels and direction
|
| 1379 |
* const socialGraph = Graph.undirected<{ name: string }, string>((mutable) => {
|
|
@@ -1398,9 +1592,10 @@ const formatMermaidNode = (nodeId, label, shape) => {
|
|
| 1398 |
* // 1 ---|"colleagues"| 2
|
| 1399 |
* ```
|
| 1400 |
*
|
| 1401 |
-
*
|
|
|
|
| 1402 |
* ```ts
|
| 1403 |
-
* import
|
| 1404 |
*
|
| 1405 |
* // Advanced styling with node shapes for flowchart
|
| 1406 |
* const workflow = Graph.directed<{ type: string; name: string }, string>(
|
|
@@ -1449,9 +1644,10 @@ const formatMermaidNode = (nodeId, label, shape) => {
|
|
| 1449 |
* // 2 --> 3
|
| 1450 |
* ```
|
| 1451 |
*
|
| 1452 |
-
*
|
|
|
|
| 1453 |
* ```ts
|
| 1454 |
-
* import
|
| 1455 |
*
|
| 1456 |
* // Real-world example: Software dependency graph
|
| 1457 |
* interface Dependency {
|
|
@@ -1510,12 +1706,8 @@ const formatMermaidNode = (nodeId, label, shape) => {
|
|
| 1510 |
* // 0 -->|"builds with"| 3
|
| 1511 |
* ```
|
| 1512 |
*
|
| 1513 |
-
* @
|
| 1514 |
-
* @
|
| 1515 |
-
* @returns Mermaid diagram syntax as a string
|
| 1516 |
-
*
|
| 1517 |
-
* @since 4.0.0
|
| 1518 |
-
* @category utils
|
| 1519 |
*/
|
| 1520 |
export const toMermaid = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, options) => {
|
| 1521 |
// Extract and validate options with defaults
|
|
@@ -1557,13 +1749,16 @@ export const toMermaid = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, opt
|
|
| 1557 |
// Graph Structure Analysis Algorithms
|
| 1558 |
// =============================================================================
|
| 1559 |
/**
|
| 1560 |
-
* Checks
|
|
|
|
|
|
|
| 1561 |
*
|
| 1562 |
* Uses depth-first search to detect back edges, which indicate cycles.
|
| 1563 |
* For directed graphs, any back edge creates a cycle. For undirected graphs,
|
| 1564 |
* a back edge that doesn't go to the immediate parent creates a cycle.
|
| 1565 |
*
|
| 1566 |
-
*
|
|
|
|
| 1567 |
* ```ts
|
| 1568 |
* import { Graph } from "effect"
|
| 1569 |
*
|
|
@@ -1587,14 +1782,48 @@ export const toMermaid = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, opt
|
|
| 1587 |
* console.log(Graph.isAcyclic(cyclic)) // false
|
| 1588 |
* ```
|
| 1589 |
*
|
| 1590 |
-
* @since 4.0.0
|
| 1591 |
* @category algorithms
|
|
|
|
| 1592 |
*/
|
| 1593 |
export const isAcyclic = graph => {
|
| 1594 |
// Use existing cycle flag if available
|
| 1595 |
if (Option.isSome(graph.acyclic)) {
|
| 1596 |
return graph.acyclic.value;
|
| 1597 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1598 |
// Stack-safe DFS cycle detection using iterative approach
|
| 1599 |
const visited = new Set();
|
| 1600 |
const recursionStack = new Set();
|
|
@@ -1621,7 +1850,7 @@ export const isAcyclic = graph => {
|
|
| 1621 |
visited.add(node);
|
| 1622 |
recursionStack.add(node);
|
| 1623 |
// Get neighbors for this node
|
| 1624 |
-
const nodeNeighbors =
|
| 1625 |
stack[stack.length - 1] = [node, nodeNeighbors, 0, false];
|
| 1626 |
continue;
|
| 1627 |
}
|
|
@@ -1649,13 +1878,16 @@ export const isAcyclic = graph => {
|
|
| 1649 |
return true;
|
| 1650 |
};
|
| 1651 |
/**
|
| 1652 |
-
* Checks
|
|
|
|
|
|
|
| 1653 |
*
|
| 1654 |
* A bipartite graph is one whose vertices can be divided into two disjoint sets
|
| 1655 |
* such that no two vertices within the same set are adjacent. Uses BFS coloring
|
| 1656 |
* to determine bipartiteness.
|
| 1657 |
*
|
| 1658 |
-
*
|
|
|
|
| 1659 |
* ```ts
|
| 1660 |
* import { Graph } from "effect"
|
| 1661 |
*
|
|
@@ -1683,8 +1915,8 @@ export const isAcyclic = graph => {
|
|
| 1683 |
* console.log(Graph.isBipartite(triangle)) // false
|
| 1684 |
* ```
|
| 1685 |
*
|
| 1686 |
-
* @since 4.0.0
|
| 1687 |
* @category algorithms
|
|
|
|
| 1688 |
*/
|
| 1689 |
export const isBipartite = graph => {
|
| 1690 |
const coloring = new Map();
|
|
@@ -1746,11 +1978,14 @@ const getUndirectedNeighbors = (graph, nodeIndex) => {
|
|
| 1746 |
}
|
| 1747 |
return Array.from(neighbors);
|
| 1748 |
};
|
|
|
|
|
|
|
| 1749 |
/**
|
| 1750 |
-
*
|
| 1751 |
* Each component is represented as an array of node indices.
|
| 1752 |
*
|
| 1753 |
-
*
|
|
|
|
| 1754 |
* ```ts
|
| 1755 |
* import { Graph } from "effect"
|
| 1756 |
*
|
|
@@ -1767,8 +2002,8 @@ const getUndirectedNeighbors = (graph, nodeIndex) => {
|
|
| 1767 |
* console.log(components) // [[0, 1], [2, 3]]
|
| 1768 |
* ```
|
| 1769 |
*
|
| 1770 |
-
* @since 4.0.0
|
| 1771 |
* @category algorithms
|
|
|
|
| 1772 |
*/
|
| 1773 |
export const connectedComponents = graph => {
|
| 1774 |
const visited = new Set();
|
|
@@ -1798,10 +2033,15 @@ export const connectedComponents = graph => {
|
|
| 1798 |
return components;
|
| 1799 |
};
|
| 1800 |
/**
|
| 1801 |
-
*
|
| 1802 |
* Each SCC is represented as an array of node indices.
|
| 1803 |
*
|
| 1804 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1805 |
* ```ts
|
| 1806 |
* import { Graph } from "effect"
|
| 1807 |
*
|
|
@@ -1818,10 +2058,15 @@ export const connectedComponents = graph => {
|
|
| 1818 |
* console.log(sccs) // [[0, 1, 2]]
|
| 1819 |
* ```
|
| 1820 |
*
|
| 1821 |
-
* @since 4.0.0
|
| 1822 |
* @category algorithms
|
|
|
|
| 1823 |
*/
|
| 1824 |
export const stronglyConnectedComponents = graph => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1825 |
const visited = new Set();
|
| 1826 |
const finishOrder = [];
|
| 1827 |
for (const startNode of graph.nodes.keys()) {
|
|
@@ -1837,7 +2082,7 @@ export const stronglyConnectedComponents = graph => {
|
|
| 1837 |
continue;
|
| 1838 |
}
|
| 1839 |
visited.add(node);
|
| 1840 |
-
const nodeNeighborsList =
|
| 1841 |
stack[stack.length - 1] = [node, nodeNeighborsList, 0, false];
|
| 1842 |
continue;
|
| 1843 |
}
|
|
@@ -1890,13 +2135,31 @@ export const stronglyConnectedComponents = graph => {
|
|
| 1890 |
}
|
| 1891 |
return sccs;
|
| 1892 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1893 |
/**
|
| 1894 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1895 |
*
|
| 1896 |
-
*
|
| 1897 |
-
* path from a source node to a target node in O((V + E) log V) time complexity.
|
| 1898 |
*
|
| 1899 |
-
* @example
|
| 1900 |
* ```ts
|
| 1901 |
* import { Graph } from "effect"
|
| 1902 |
*
|
|
@@ -1921,8 +2184,8 @@ export const stronglyConnectedComponents = graph => {
|
|
| 1921 |
* }
|
| 1922 |
* ```
|
| 1923 |
*
|
| 1924 |
-
* @since 4.0.0
|
| 1925 |
* @category algorithms
|
|
|
|
| 1926 |
*/
|
| 1927 |
export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
| 1928 |
// Validate that source and target nodes exist
|
|
@@ -1932,6 +2195,7 @@ export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 1932 |
if (!graph.nodes.has(config.target)) {
|
| 1933 |
throw missingNode(config.target);
|
| 1934 |
}
|
|
|
|
| 1935 |
// Early return if source equals target
|
| 1936 |
if (config.source === config.target) {
|
| 1937 |
return Option.some({
|
|
@@ -1982,14 +2246,8 @@ export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 1982 |
for (const edgeIndex of adjacencyList) {
|
| 1983 |
const edge = graph.edges.get(edgeIndex);
|
| 1984 |
if (edge !== undefined) {
|
| 1985 |
-
const neighbor = edge
|
| 1986 |
-
const cost =
|
| 1987 |
-
// Validate non-negative weights
|
| 1988 |
-
if (cost < 0) {
|
| 1989 |
-
throw new GraphError({
|
| 1990 |
-
message: "Dijkstra's algorithm requires non-negative edge weights"
|
| 1991 |
-
});
|
| 1992 |
-
}
|
| 1993 |
const newDistance = currentDistance + cost;
|
| 1994 |
const neighborDistance = distances.get(neighbor);
|
| 1995 |
// Relaxation step
|
|
@@ -2037,14 +2295,17 @@ export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2037 |
});
|
| 2038 |
});
|
| 2039 |
/**
|
| 2040 |
-
*
|
|
|
|
| 2041 |
*
|
| 2042 |
-
*
|
| 2043 |
-
* It can handle negative edge weights and detect negative cycles.
|
| 2044 |
*
|
| 2045 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2046 |
*
|
| 2047 |
-
* @example
|
| 2048 |
* ```ts
|
| 2049 |
* import { Graph } from "effect"
|
| 2050 |
*
|
|
@@ -2062,8 +2323,8 @@ export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2062 |
* const pathAToC = result.paths.get(0)?.get(2) // [0, 1, 2]
|
| 2063 |
* ```
|
| 2064 |
*
|
| 2065 |
-
* @since 4.0.0
|
| 2066 |
* @category algorithms
|
|
|
|
| 2067 |
*/
|
| 2068 |
export const floydWarshall = /*#__PURE__*/dual(2, (graph, cost) => {
|
| 2069 |
// Get all nodes for Floyd-Warshall algorithm (needs array for nested iteration)
|
|
@@ -2095,6 +2356,14 @@ export const floydWarshall = /*#__PURE__*/dual(2, (graph, cost) => {
|
|
| 2095 |
next.get(i).set(j, j);
|
| 2096 |
edgeMatrix.get(i).set(j, edgeData.data);
|
| 2097 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2098 |
}
|
| 2099 |
// Floyd-Warshall main loop
|
| 2100 |
for (const k of allNodes) {
|
|
@@ -2159,13 +2428,18 @@ export const floydWarshall = /*#__PURE__*/dual(2, (graph, cost) => {
|
|
| 2159 |
};
|
| 2160 |
});
|
| 2161 |
/**
|
| 2162 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2163 |
*
|
| 2164 |
-
*
|
| 2165 |
-
* the search towards the target, potentially finding paths faster than Dijkstra's.
|
| 2166 |
-
* The heuristic must be admissible (never overestimate the actual cost).
|
| 2167 |
*
|
| 2168 |
-
* @example
|
| 2169 |
* ```ts
|
| 2170 |
* import { Graph } from "effect"
|
| 2171 |
*
|
|
@@ -2196,8 +2470,8 @@ export const floydWarshall = /*#__PURE__*/dual(2, (graph, cost) => {
|
|
| 2196 |
* }
|
| 2197 |
* ```
|
| 2198 |
*
|
| 2199 |
-
* @since 4.0.0
|
| 2200 |
* @category algorithms
|
|
|
|
| 2201 |
*/
|
| 2202 |
export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
| 2203 |
// Validate that source and target nodes exist
|
|
@@ -2207,6 +2481,7 @@ export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2207 |
if (!graph.nodes.has(config.target)) {
|
| 2208 |
throw missingNode(config.target);
|
| 2209 |
}
|
|
|
|
| 2210 |
// Early return if source equals target
|
| 2211 |
if (config.source === config.target) {
|
| 2212 |
return Option.some({
|
|
@@ -2272,14 +2547,8 @@ export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2272 |
for (const edgeIndex of adjacencyList) {
|
| 2273 |
const edge = graph.edges.get(edgeIndex);
|
| 2274 |
if (edge !== undefined) {
|
| 2275 |
-
const neighbor = edge
|
| 2276 |
-
const weight =
|
| 2277 |
-
// Validate non-negative weights
|
| 2278 |
-
if (weight < 0) {
|
| 2279 |
-
throw new GraphError({
|
| 2280 |
-
message: "A* algorithm requires non-negative edge weights"
|
| 2281 |
-
});
|
| 2282 |
-
}
|
| 2283 |
const tentativeGScore = currentGScore + weight;
|
| 2284 |
const neighborGScore = gScore.get(neighbor);
|
| 2285 |
// If this path to neighbor is better than any previous one
|
|
@@ -2335,13 +2604,17 @@ export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2335 |
});
|
| 2336 |
});
|
| 2337 |
/**
|
| 2338 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2339 |
*
|
| 2340 |
-
*
|
| 2341 |
-
* It has O(VE) time complexity, slower than Dijkstra's but more versatile.
|
| 2342 |
-
* Returns Option.none() if a negative cycle is detected that affects the path.
|
| 2343 |
*
|
| 2344 |
-
* @example
|
| 2345 |
* ```ts
|
| 2346 |
* import { Graph } from "effect"
|
| 2347 |
*
|
|
@@ -2366,8 +2639,8 @@ export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2366 |
* }
|
| 2367 |
* ```
|
| 2368 |
*
|
| 2369 |
-
* @since 4.0.0
|
| 2370 |
* @category algorithms
|
|
|
|
| 2371 |
*/
|
| 2372 |
export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
| 2373 |
// Validate that source and target nodes exist
|
|
@@ -2403,6 +2676,14 @@ export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2403 |
weight,
|
| 2404 |
edgeData: edgeData.data
|
| 2405 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2406 |
}
|
| 2407 |
// Relax edges up to V-1 times
|
| 2408 |
const nodeCount = graph.nodes.size;
|
|
@@ -2439,14 +2720,8 @@ export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2439 |
if (affectedNodes.has(node)) continue;
|
| 2440 |
affectedNodes.add(node);
|
| 2441 |
// Add all nodes reachable from this node
|
| 2442 |
-
const
|
| 2443 |
-
|
| 2444 |
-
for (const edgeIndex of adjacencyList) {
|
| 2445 |
-
const edge = graph.edges.get(edgeIndex);
|
| 2446 |
-
if (edge !== undefined) {
|
| 2447 |
-
queue.push(edge.target);
|
| 2448 |
-
}
|
| 2449 |
-
}
|
| 2450 |
}
|
| 2451 |
}
|
| 2452 |
// If target is affected by a negative cycle, no shortest path exists.
|
|
@@ -2481,13 +2756,16 @@ export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2481 |
});
|
| 2482 |
});
|
| 2483 |
/**
|
| 2484 |
-
*
|
| 2485 |
*
|
| 2486 |
-
*
|
| 2487 |
-
*
|
| 2488 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2489 |
*
|
| 2490 |
-
* @example
|
| 2491 |
* ```ts
|
| 2492 |
* import { Graph } from "effect"
|
| 2493 |
*
|
|
@@ -2511,8 +2789,8 @@ export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
|
| 2511 |
* const nodeEntries = Array.from(Graph.entries(allNodes)) // [[0, "A"], [1, "B"]]
|
| 2512 |
* ```
|
| 2513 |
*
|
| 2514 |
-
* @since 4.0.0
|
| 2515 |
* @category models
|
|
|
|
| 2516 |
*/
|
| 2517 |
export class Walker {
|
| 2518 |
// @ts-ignore
|
|
@@ -2520,11 +2798,14 @@ export class Walker {
|
|
| 2520 |
/**
|
| 2521 |
* Visits each element and maps it to a value using the provided function.
|
| 2522 |
*
|
|
|
|
|
|
|
| 2523 |
* Takes a function that receives the index and data,
|
| 2524 |
* and returns an iterable of the mapped values. Skips elements that
|
| 2525 |
* no longer exist in the graph.
|
| 2526 |
*
|
| 2527 |
-
*
|
|
|
|
| 2528 |
* ```ts
|
| 2529 |
* import { Graph } from "effect"
|
| 2530 |
*
|
|
@@ -2548,7 +2829,6 @@ export class Walker {
|
|
| 2548 |
* ```
|
| 2549 |
*
|
| 2550 |
* @since 4.0.0
|
| 2551 |
-
* @category iterators
|
| 2552 |
*/
|
| 2553 |
visit;
|
| 2554 |
constructor(
|
|
@@ -2559,7 +2839,8 @@ export class Walker {
|
|
| 2559 |
* and returns an iterable of the mapped values. Skips elements that
|
| 2560 |
* no longer exist in the graph.
|
| 2561 |
*
|
| 2562 |
-
*
|
|
|
|
| 2563 |
* ```ts
|
| 2564 |
* import { Graph } from "effect"
|
| 2565 |
*
|
|
@@ -2582,8 +2863,8 @@ export class Walker {
|
|
| 2582 |
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
| 2583 |
* ```
|
| 2584 |
*
|
| 2585 |
-
* @since 4.0.0
|
| 2586 |
* @category iterators
|
|
|
|
| 2587 |
*/
|
| 2588 |
visit) {
|
| 2589 |
this.visit = visit;
|
|
@@ -2593,7 +2874,8 @@ export class Walker {
|
|
| 2593 |
/**
|
| 2594 |
* Returns an iterator over the indices in the walker.
|
| 2595 |
*
|
| 2596 |
-
*
|
|
|
|
| 2597 |
* ```ts
|
| 2598 |
* import { Graph } from "effect"
|
| 2599 |
*
|
|
@@ -2608,14 +2890,15 @@ export class Walker {
|
|
| 2608 |
* console.log(indices) // [0, 1]
|
| 2609 |
* ```
|
| 2610 |
*
|
| 2611 |
-
* @
|
| 2612 |
-
* @
|
| 2613 |
*/
|
| 2614 |
export const indices = walker => walker.visit((index, _) => index);
|
| 2615 |
/**
|
| 2616 |
* Returns an iterator over the values (data) in the walker.
|
| 2617 |
*
|
| 2618 |
-
*
|
|
|
|
| 2619 |
* ```ts
|
| 2620 |
* import { Graph } from "effect"
|
| 2621 |
*
|
|
@@ -2630,14 +2913,15 @@ export const indices = walker => walker.visit((index, _) => index);
|
|
| 2630 |
* console.log(values) // ["A", "B"]
|
| 2631 |
* ```
|
| 2632 |
*
|
| 2633 |
-
* @
|
| 2634 |
-
* @
|
| 2635 |
*/
|
| 2636 |
export const values = walker => walker.visit((_, data) => data);
|
| 2637 |
/**
|
| 2638 |
* Returns an iterator over [index, data] entries in the walker.
|
| 2639 |
*
|
| 2640 |
-
*
|
|
|
|
| 2641 |
* ```ts
|
| 2642 |
* import { Graph } from "effect"
|
| 2643 |
*
|
|
@@ -2652,17 +2936,22 @@ export const values = walker => walker.visit((_, data) => data);
|
|
| 2652 |
* console.log(entries) // [[0, "A"], [1, "B"]]
|
| 2653 |
* ```
|
| 2654 |
*
|
| 2655 |
-
* @
|
| 2656 |
-
* @
|
| 2657 |
*/
|
| 2658 |
export const entries = walker => walker.visit((index, data) => [index, data]);
|
| 2659 |
/**
|
| 2660 |
-
* Creates a
|
|
|
|
|
|
|
|
|
|
| 2661 |
*
|
| 2662 |
-
*
|
| 2663 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2664 |
*
|
| 2665 |
-
* @example
|
| 2666 |
* ```ts
|
| 2667 |
* import { Graph } from "effect"
|
| 2668 |
*
|
|
@@ -2685,8 +2974,8 @@ export const entries = walker => walker.visit((index, data) => [index, data]);
|
|
| 2685 |
* // Can be used programmatically
|
| 2686 |
* ```
|
| 2687 |
*
|
| 2688 |
-
* @since 4.0.0
|
| 2689 |
* @category iterators
|
|
|
|
| 2690 |
*/
|
| 2691 |
export const dfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 2692 |
const start = config.start ?? [];
|
|
@@ -2712,7 +3001,7 @@ export const dfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2712 |
if (Option.isNone(nodeDataOption)) {
|
| 2713 |
continue;
|
| 2714 |
}
|
| 2715 |
-
const neighbors =
|
| 2716 |
for (let i = neighbors.length - 1; i >= 0; i--) {
|
| 2717 |
const neighbor = neighbors[i];
|
| 2718 |
if (!discovered.has(neighbor)) {
|
|
@@ -2736,12 +3025,17 @@ export const dfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2736 |
}));
|
| 2737 |
});
|
| 2738 |
/**
|
| 2739 |
-
* Creates a
|
|
|
|
|
|
|
|
|
|
| 2740 |
*
|
| 2741 |
-
*
|
| 2742 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2743 |
*
|
| 2744 |
-
* @example
|
| 2745 |
* ```ts
|
| 2746 |
* import { Graph } from "effect"
|
| 2747 |
*
|
|
@@ -2764,8 +3058,8 @@ export const dfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2764 |
* // Can be used programmatically
|
| 2765 |
* ```
|
| 2766 |
*
|
| 2767 |
-
* @since 4.0.0
|
| 2768 |
* @category iterators
|
|
|
|
| 2769 |
*/
|
| 2770 |
export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 2771 |
const start = config.start ?? [];
|
|
@@ -2785,7 +3079,7 @@ export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2785 |
const current = queue.shift();
|
| 2786 |
if (!discovered.has(current)) {
|
| 2787 |
discovered.add(current);
|
| 2788 |
-
const neighbors =
|
| 2789 |
for (const neighbor of neighbors) {
|
| 2790 |
if (!discovered.has(neighbor)) {
|
| 2791 |
queue.push(neighbor);
|
|
@@ -2815,10 +3109,13 @@ export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2815 |
/**
|
| 2816 |
* Creates a new topological sort iterator with optional configuration.
|
| 2817 |
*
|
|
|
|
|
|
|
| 2818 |
* The iterator uses Kahn's algorithm to lazily produce nodes in topological order.
|
| 2819 |
* Throws an error if the graph contains cycles.
|
| 2820 |
*
|
| 2821 |
-
*
|
|
|
|
| 2822 |
* ```ts
|
| 2823 |
* import { Graph } from "effect"
|
| 2824 |
*
|
|
@@ -2839,7 +3136,7 @@ export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2839 |
* // With initial nodes
|
| 2840 |
* const topo2 = Graph.topo(graph, { initials: [0] })
|
| 2841 |
*
|
| 2842 |
-
* //
|
| 2843 |
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
| 2844 |
* const a = Graph.addNode(mutable, "A")
|
| 2845 |
* const b = Graph.addNode(mutable, "B")
|
|
@@ -2847,17 +3144,20 @@ export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2847 |
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
| 2848 |
* })
|
| 2849 |
*
|
| 2850 |
-
*
|
| 2851 |
-
*
|
| 2852 |
-
* } catch (error) {
|
| 2853 |
-
* console.log((error as Error).message)
|
| 2854 |
* }
|
| 2855 |
* ```
|
| 2856 |
*
|
| 2857 |
-
* @since 4.0.0
|
| 2858 |
* @category iterators
|
|
|
|
| 2859 |
*/
|
| 2860 |
export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2861 |
// Check if graph is acyclic first
|
| 2862 |
if (!isAcyclic(graph)) {
|
| 2863 |
throw new GraphError({
|
|
@@ -2875,6 +3175,7 @@ export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2875 |
[Symbol.iterator]: () => {
|
| 2876 |
const inDegree = new Map();
|
| 2877 |
const remaining = new Set();
|
|
|
|
| 2878 |
const queue = [...initials];
|
| 2879 |
// Initialize in-degree counts
|
| 2880 |
for (const [nodeIndex] of graph.nodes) {
|
|
@@ -2886,12 +3187,17 @@ export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2886 |
const currentInDegree = inDegree.get(edgeData.target) || 0;
|
| 2887 |
inDegree.set(edgeData.target, currentInDegree + 1);
|
| 2888 |
}
|
| 2889 |
-
|
| 2890 |
-
|
| 2891 |
-
|
| 2892 |
-
|
| 2893 |
-
|
| 2894 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2895 |
}
|
| 2896 |
}
|
| 2897 |
const nextMapped = () => {
|
|
@@ -2900,7 +3206,7 @@ export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2900 |
if (remaining.has(current)) {
|
| 2901 |
remaining.delete(current);
|
| 2902 |
// Process outgoing edges, reducing in-degree of targets
|
| 2903 |
-
const neighbors =
|
| 2904 |
for (const neighbor of neighbors) {
|
| 2905 |
if (remaining.has(neighbor)) {
|
| 2906 |
const currentInDegree = inDegree.get(neighbor) || 0;
|
|
@@ -2934,13 +3240,17 @@ export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2934 |
}));
|
| 2935 |
});
|
| 2936 |
/**
|
| 2937 |
-
* Creates a
|
|
|
|
|
|
|
|
|
|
| 2938 |
*
|
| 2939 |
-
*
|
| 2940 |
-
*
|
| 2941 |
-
*
|
|
|
|
|
|
|
| 2942 |
*
|
| 2943 |
-
* @example
|
| 2944 |
* ```ts
|
| 2945 |
* import { Graph } from "effect"
|
| 2946 |
*
|
|
@@ -2959,8 +3269,8 @@ export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config =
|
|
| 2959 |
* }
|
| 2960 |
* ```
|
| 2961 |
*
|
| 2962 |
-
* @since 4.0.0
|
| 2963 |
* @category iterators
|
|
|
|
| 2964 |
*/
|
| 2965 |
export const dfsPostOrder = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 2966 |
const start = config.start ?? [];
|
|
@@ -2992,7 +3302,7 @@ export const dfsPostOrder = /*#__PURE__*/dual(args => isGraph(args[0]), (graph,
|
|
| 2992 |
}
|
| 2993 |
if (!current.visitedChildren) {
|
| 2994 |
current.visitedChildren = true;
|
| 2995 |
-
const neighbors =
|
| 2996 |
for (let i = neighbors.length - 1; i >= 0; i--) {
|
| 2997 |
const neighbor = neighbors[i];
|
| 2998 |
if (!discovered.has(neighbor) && !finished.has(neighbor)) {
|
|
@@ -3031,10 +3341,13 @@ export const dfsPostOrder = /*#__PURE__*/dual(args => isGraph(args[0]), (graph,
|
|
| 3031 |
/**
|
| 3032 |
* Creates an iterator over all node indices in the graph.
|
| 3033 |
*
|
|
|
|
|
|
|
| 3034 |
* The iterator produces node indices in the order they were added to the graph.
|
| 3035 |
* This provides access to all nodes regardless of connectivity.
|
| 3036 |
*
|
| 3037 |
-
*
|
|
|
|
| 3038 |
* ```ts
|
| 3039 |
* import { Graph } from "effect"
|
| 3040 |
*
|
|
@@ -3049,8 +3362,8 @@ export const dfsPostOrder = /*#__PURE__*/dual(args => isGraph(args[0]), (graph,
|
|
| 3049 |
* console.log(indices) // [0, 1, 2]
|
| 3050 |
* ```
|
| 3051 |
*
|
| 3052 |
-
* @since 4.0.0
|
| 3053 |
* @category iterators
|
|
|
|
| 3054 |
*/
|
| 3055 |
export const nodes = graph => new Walker(f => ({
|
| 3056 |
[Symbol.iterator]() {
|
|
@@ -3077,10 +3390,13 @@ export const nodes = graph => new Walker(f => ({
|
|
| 3077 |
/**
|
| 3078 |
* Creates an iterator over all edge indices in the graph.
|
| 3079 |
*
|
|
|
|
|
|
|
| 3080 |
* The iterator produces edge indices in the order they were added to the graph.
|
| 3081 |
* This provides access to all edges regardless of connectivity.
|
| 3082 |
*
|
| 3083 |
-
*
|
|
|
|
| 3084 |
* ```ts
|
| 3085 |
* import { Graph } from "effect"
|
| 3086 |
*
|
|
@@ -3096,8 +3412,8 @@ export const nodes = graph => new Walker(f => ({
|
|
| 3096 |
* console.log(indices) // [0, 1]
|
| 3097 |
* ```
|
| 3098 |
*
|
| 3099 |
-
* @since 4.0.0
|
| 3100 |
* @category iterators
|
|
|
|
| 3101 |
*/
|
| 3102 |
export const edges = graph => new Walker(f => ({
|
| 3103 |
[Symbol.iterator]() {
|
|
@@ -3122,13 +3438,16 @@ export const edges = graph => new Walker(f => ({
|
|
| 3122 |
}
|
| 3123 |
}));
|
| 3124 |
/**
|
| 3125 |
-
* Creates an iterator over external nodes (nodes without edges in specified direction).
|
|
|
|
|
|
|
| 3126 |
*
|
| 3127 |
-
* External nodes
|
| 3128 |
-
*
|
| 3129 |
* sources, sinks, or isolated nodes.
|
| 3130 |
*
|
| 3131 |
-
*
|
|
|
|
| 3132 |
* ```ts
|
| 3133 |
* import { Graph } from "effect"
|
| 3134 |
*
|
|
@@ -3155,8 +3474,8 @@ export const edges = graph => new Walker(f => ({
|
|
| 3155 |
* console.log(sources) // [0, 3]
|
| 3156 |
* ```
|
| 3157 |
*
|
| 3158 |
-
* @since 4.0.0
|
| 3159 |
* @category iterators
|
|
|
|
| 3160 |
*/
|
| 3161 |
export const externals = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 3162 |
const direction = config.direction ?? "outgoing";
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Models relationships between indexed nodes and edges.
|
| 3 |
+
*
|
| 4 |
+
* This module provides immutable and scoped-mutable graph data structures. A
|
| 5 |
+
* graph can be directed or undirected, and it can store user-defined data on
|
| 6 |
+
* both nodes and edges. The module includes traversal, analysis, path-finding,
|
| 7 |
+
* transformation, and diagram export utilities.
|
| 8 |
+
*
|
| 9 |
* @since 4.0.0
|
| 10 |
*/
|
| 11 |
import * as Data from "./Data.js";
|
|
|
|
| 18 |
import { hasProperty } from "./Predicate.js";
|
| 19 |
const TypeId = "~effect/collections/Graph";
|
| 20 |
/**
|
| 21 |
+
* Represents edge data containing source, target, and user data.
|
| 22 |
+
*
|
| 23 |
+
* **When to use**
|
| 24 |
+
*
|
| 25 |
+
* Use as the graph edge value that carries source node, target node, and stored
|
| 26 |
+
* edge data together.
|
| 27 |
+
*
|
| 28 |
+
* @see {@link getEdge} for reading a single edge by identifier
|
| 29 |
+
* @see {@link addEdge} for adding edges to a graph
|
| 30 |
+
* @see {@link edges} for iterating graph edges
|
| 31 |
*
|
|
|
|
| 32 |
* @category models
|
| 33 |
+
* @since 3.18.0
|
| 34 |
*/
|
| 35 |
export class Edge extends Data.Class {}
|
| 36 |
// =============================================================================
|
|
|
|
| 107 |
// =============================================================================
|
| 108 |
// TODO: Do we need safe variants for these?
|
| 109 |
/**
|
| 110 |
+
* Error thrown by graph operations when the requested graph structure is
|
| 111 |
+
* invalid, such as referencing a missing node or using unsupported edge
|
| 112 |
+
* weights.
|
| 113 |
+
*
|
| 114 |
+
* **When to use**
|
| 115 |
+
*
|
| 116 |
+
* Use when handling failures thrown by graph operations that reject invalid
|
| 117 |
+
* graph structure or unsupported algorithm inputs.
|
| 118 |
+
*
|
| 119 |
* @category errors
|
| 120 |
+
* @since 3.18.0
|
| 121 |
*/
|
| 122 |
export class GraphError extends /*#__PURE__*/Data.TaggedError("GraphError") {}
|
| 123 |
/** @internal */
|
|
|
|
| 128 |
// Constructors
|
| 129 |
// =============================================================================
|
| 130 |
/**
|
| 131 |
+
* Returns `true` if a value has the graph runtime type identifier, narrowing
|
| 132 |
+
* it to a `Graph`.
|
| 133 |
+
*
|
| 134 |
+
* **When to use**
|
| 135 |
+
*
|
| 136 |
+
* Use to narrow an unknown value before treating it as a graph value.
|
| 137 |
+
*
|
| 138 |
+
* **Gotchas**
|
| 139 |
+
*
|
| 140 |
+
* This guard checks the shared graph runtime type identifier and does not
|
| 141 |
+
* distinguish immutable graphs from mutable graphs.
|
| 142 |
+
*
|
| 143 |
+
* @category guards
|
| 144 |
* @since 4.0.0
|
|
|
|
| 145 |
*/
|
| 146 |
export const isGraph = u => hasProperty(u, TypeId);
|
| 147 |
/**
|
| 148 |
* Creates a directed graph, optionally with initial mutations.
|
| 149 |
*
|
| 150 |
+
* **Example** (Creating a directed graph)
|
| 151 |
+
*
|
| 152 |
* ```ts
|
| 153 |
* import { Graph } from "effect"
|
| 154 |
*
|
|
|
|
| 162 |
* })
|
| 163 |
* ```
|
| 164 |
*
|
|
|
|
| 165 |
* @category constructors
|
| 166 |
+
* @since 3.18.0
|
| 167 |
*/
|
| 168 |
export const directed = mutate => {
|
| 169 |
const graph = Object.create(ProtoGraph);
|
|
|
|
| 186 |
/**
|
| 187 |
* Creates an undirected graph, optionally with initial mutations.
|
| 188 |
*
|
| 189 |
+
* **Example** (Creating an undirected graph)
|
| 190 |
+
*
|
| 191 |
* ```ts
|
| 192 |
* import { Graph } from "effect"
|
| 193 |
*
|
|
|
|
| 201 |
* })
|
| 202 |
* ```
|
| 203 |
*
|
|
|
|
| 204 |
* @category constructors
|
| 205 |
+
* @since 3.18.0
|
| 206 |
*/
|
| 207 |
export const undirected = mutate => {
|
| 208 |
const graph = Object.create(ProtoGraph);
|
|
|
|
| 228 |
/**
|
| 229 |
* Creates a mutable scope for safe graph mutations by copying the data structure.
|
| 230 |
*
|
| 231 |
+
* **Example** (Beginning a mutation scope)
|
| 232 |
+
*
|
| 233 |
* ```ts
|
| 234 |
* import { Graph } from "effect"
|
| 235 |
*
|
|
|
|
| 238 |
* // Now mutable can be safely modified without affecting original graph
|
| 239 |
* ```
|
| 240 |
*
|
|
|
|
| 241 |
* @category mutations
|
| 242 |
+
* @since 3.18.0
|
| 243 |
*/
|
| 244 |
export const beginMutation = graph => {
|
| 245 |
// Copy adjacency maps with deep cloned arrays
|
|
|
|
| 266 |
/**
|
| 267 |
* Converts a mutable graph back to an immutable graph, ending the mutation scope.
|
| 268 |
*
|
| 269 |
+
* **Example** (Ending a mutation scope)
|
| 270 |
+
*
|
| 271 |
* ```ts
|
| 272 |
* import { Graph } from "effect"
|
| 273 |
*
|
|
|
|
| 277 |
* const newGraph = Graph.endMutation(mutable)
|
| 278 |
* ```
|
| 279 |
*
|
|
|
|
| 280 |
* @category mutations
|
| 281 |
+
* @since 3.18.0
|
| 282 |
*/
|
| 283 |
export const endMutation = mutable => {
|
| 284 |
const graph = Object.create(ProtoGraph);
|
|
|
|
| 296 |
/**
|
| 297 |
* Performs scoped mutations on a graph, automatically managing the mutation lifecycle.
|
| 298 |
*
|
| 299 |
+
* **Example** (Applying scoped mutations)
|
| 300 |
+
*
|
| 301 |
* ```ts
|
| 302 |
* import { Graph } from "effect"
|
| 303 |
*
|
| 304 |
* const graph = Graph.directed<string, number>()
|
| 305 |
* const newGraph = Graph.mutate(graph, (mutable) => {
|
| 306 |
+
* const nodeA = Graph.addNode(mutable, "A")
|
| 307 |
+
* const nodeB = Graph.addNode(mutable, "B")
|
| 308 |
+
* Graph.addEdge(mutable, nodeA, nodeB, 1)
|
| 309 |
* })
|
| 310 |
+
*
|
| 311 |
+
* console.log(Graph.nodeCount(newGraph)) // 2
|
| 312 |
+
* console.log(Graph.edgeCount(newGraph)) // 1
|
| 313 |
* ```
|
| 314 |
*
|
|
|
|
| 315 |
* @category mutations
|
| 316 |
+
* @since 3.18.0
|
| 317 |
*/
|
| 318 |
export const mutate = /*#__PURE__*/dual(2, (graph, f) => {
|
| 319 |
const mutable = beginMutation(graph);
|
|
|
|
| 326 |
/**
|
| 327 |
* Adds a new node to a mutable graph and returns its index.
|
| 328 |
*
|
| 329 |
+
* **When to use**
|
| 330 |
+
*
|
| 331 |
+
* Use to allocate a new node in a mutable graph before storing edges or
|
| 332 |
+
* querying it by index.
|
| 333 |
+
*
|
| 334 |
+
* **Details**
|
| 335 |
+
*
|
| 336 |
+
* The returned index is allocated from the graph's next node index. The mutable
|
| 337 |
+
* graph stores the node data and initializes empty incoming and outgoing edge
|
| 338 |
+
* indexes for the new node.
|
| 339 |
+
*
|
| 340 |
+
* **Gotchas**
|
| 341 |
+
*
|
| 342 |
+
* `NodeIndex` values are identifiers and are not reused after removals.
|
| 343 |
+
*
|
| 344 |
+
* **Example** (Adding nodes)
|
| 345 |
+
*
|
| 346 |
* ```ts
|
| 347 |
* import { Graph } from "effect"
|
| 348 |
*
|
|
|
|
| 354 |
* })
|
| 355 |
* ```
|
| 356 |
*
|
| 357 |
+
* @see {@link mutate} for obtaining a mutable graph from an immutable graph
|
| 358 |
+
* @see {@link addEdge} for connecting existing nodes
|
| 359 |
+
* @see {@link removeNode} for removing nodes from a mutable graph
|
| 360 |
+
*
|
| 361 |
* @category mutations
|
| 362 |
+
* @since 3.18.0
|
| 363 |
*/
|
| 364 |
export const addNode = (mutable, data) => {
|
| 365 |
const nodeIndex = mutable.nextNodeIndex;
|
|
|
|
| 373 |
return nodeIndex;
|
| 374 |
};
|
| 375 |
/**
|
| 376 |
+
* Gets the data associated with a node index safely, if it exists.
|
| 377 |
+
*
|
| 378 |
+
* **Example** (Getting node data)
|
| 379 |
*
|
|
|
|
| 380 |
* ```ts
|
| 381 |
+
* import { Graph, Option } from "effect"
|
|
|
|
| 382 |
*
|
| 383 |
* const graph = Graph.mutate(Graph.directed<string, number>(), (mutable) => {
|
| 384 |
* Graph.addNode(mutable, "Node A")
|
|
|
|
| 392 |
* }
|
| 393 |
* ```
|
| 394 |
*
|
|
|
|
| 395 |
* @category getters
|
| 396 |
+
* @since 3.18.0
|
| 397 |
*/
|
| 398 |
export const getNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.has(nodeIndex) ? Option.some(graph.nodes.get(nodeIndex)) : Option.none());
|
| 399 |
/**
|
| 400 |
+
* Checks whether a node with the given index exists in the graph.
|
| 401 |
+
*
|
| 402 |
+
* **Example** (Checking node existence)
|
| 403 |
*
|
|
|
|
| 404 |
* ```ts
|
| 405 |
* import { Graph } from "effect"
|
| 406 |
*
|
|
|
|
| 417 |
* console.log(notExists) // false
|
| 418 |
* ```
|
| 419 |
*
|
|
|
|
| 420 |
* @category getters
|
| 421 |
+
* @since 3.18.0
|
| 422 |
*/
|
| 423 |
export const hasNode = /*#__PURE__*/dual(2, (graph, nodeIndex) => graph.nodes.has(nodeIndex));
|
| 424 |
/**
|
| 425 |
* Returns the number of nodes in the graph.
|
| 426 |
*
|
| 427 |
+
* **Example** (Counting nodes)
|
| 428 |
+
*
|
| 429 |
* ```ts
|
| 430 |
* import { Graph } from "effect"
|
| 431 |
*
|
|
|
|
| 441 |
* console.log(Graph.nodeCount(graphWithNodes)) // 3
|
| 442 |
* ```
|
| 443 |
*
|
|
|
|
| 444 |
* @category getters
|
| 445 |
+
* @since 3.18.0
|
| 446 |
*/
|
| 447 |
export const nodeCount = graph => graph.nodes.size;
|
| 448 |
/**
|
| 449 |
* Finds the first node that matches the given predicate.
|
| 450 |
*
|
| 451 |
+
* **Example** (Finding the first matching node)
|
| 452 |
+
*
|
| 453 |
* ```ts
|
| 454 |
* import { Graph } from "effect"
|
| 455 |
*
|
|
|
|
| 466 |
* console.log(notFound) // Option.none()
|
| 467 |
* ```
|
| 468 |
*
|
|
|
|
| 469 |
* @category getters
|
| 470 |
+
* @since 3.18.0
|
| 471 |
*/
|
| 472 |
export const findNode = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 473 |
for (const [index, data] of graph.nodes) {
|
|
|
|
| 480 |
/**
|
| 481 |
* Finds all nodes that match the given predicate.
|
| 482 |
*
|
| 483 |
+
* **Example** (Finding matching nodes)
|
| 484 |
+
*
|
| 485 |
* ```ts
|
| 486 |
* import { Graph } from "effect"
|
| 487 |
*
|
|
|
|
| 498 |
* console.log(empty) // []
|
| 499 |
* ```
|
| 500 |
*
|
|
|
|
| 501 |
* @category getters
|
| 502 |
+
* @since 3.18.0
|
| 503 |
*/
|
| 504 |
export const findNodes = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 505 |
const results = [];
|
|
|
|
| 513 |
/**
|
| 514 |
* Finds the first edge that matches the given predicate.
|
| 515 |
*
|
| 516 |
+
* **Example** (Finding the first matching edge)
|
| 517 |
+
*
|
| 518 |
* ```ts
|
| 519 |
* import { Graph } from "effect"
|
| 520 |
*
|
|
|
|
| 533 |
* console.log(notFound) // Option.none()
|
| 534 |
* ```
|
| 535 |
*
|
|
|
|
| 536 |
* @category getters
|
| 537 |
+
* @since 3.18.0
|
| 538 |
*/
|
| 539 |
export const findEdge = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 540 |
for (const [edgeIndex, edgeData] of graph.edges) {
|
|
|
|
| 547 |
/**
|
| 548 |
* Finds all edges that match the given predicate.
|
| 549 |
*
|
| 550 |
+
* **Example** (Finding matching edges)
|
| 551 |
+
*
|
| 552 |
* ```ts
|
| 553 |
* import { Graph } from "effect"
|
| 554 |
*
|
|
|
|
| 568 |
* console.log(empty) // []
|
| 569 |
* ```
|
| 570 |
*
|
|
|
|
| 571 |
* @category getters
|
| 572 |
+
* @since 3.18.0
|
| 573 |
*/
|
| 574 |
export const findEdges = /*#__PURE__*/dual(2, (graph, predicate) => {
|
| 575 |
const results = [];
|
|
|
|
| 583 |
/**
|
| 584 |
* Updates a single node's data by applying a transformation function.
|
| 585 |
*
|
| 586 |
+
* **Example** (Updating node data)
|
| 587 |
+
*
|
| 588 |
* ```ts
|
| 589 |
* import { Graph } from "effect"
|
| 590 |
*
|
|
|
|
| 598 |
* console.log(nodeData) // Option.some("NODE A")
|
| 599 |
* ```
|
| 600 |
*
|
| 601 |
+
* @category transforming
|
| 602 |
+
* @since 3.18.0
|
| 603 |
*/
|
| 604 |
export const updateNode = (mutable, index, f) => {
|
| 605 |
if (!mutable.nodes.has(index)) {
|
|
|
|
| 612 |
/**
|
| 613 |
* Updates a single edge's data by applying a transformation function.
|
| 614 |
*
|
| 615 |
+
* **Example** (Updating edge data)
|
| 616 |
+
*
|
| 617 |
* ```ts
|
| 618 |
* import { Graph } from "effect"
|
| 619 |
*
|
|
|
|
| 625 |
* })
|
| 626 |
*
|
| 627 |
* const edgeData = Graph.getEdge(result, 0)
|
| 628 |
+
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
| 629 |
* ```
|
| 630 |
*
|
|
|
|
| 631 |
* @category mutations
|
| 632 |
+
* @since 3.18.0
|
| 633 |
*/
|
| 634 |
export const updateEdge = (mutable, edgeIndex, f) => {
|
| 635 |
if (!mutable.edges.has(edgeIndex)) {
|
|
|
|
| 643 |
}));
|
| 644 |
};
|
| 645 |
/**
|
| 646 |
+
* Transforms every node's data in a mutable graph in place using the provided
|
| 647 |
+
* mapping function.
|
| 648 |
+
*
|
| 649 |
+
* **Details**
|
| 650 |
+
*
|
| 651 |
+
* Node indices and edges are preserved; only the stored node data is replaced.
|
| 652 |
+
*
|
| 653 |
+
* **Example** (Mapping node data)
|
| 654 |
*
|
|
|
|
| 655 |
* ```ts
|
| 656 |
* import { Graph } from "effect"
|
| 657 |
*
|
|
|
|
| 663 |
* })
|
| 664 |
*
|
| 665 |
* const nodeData = Graph.getNode(graph, 0)
|
| 666 |
+
* console.log(nodeData) // Option.some("NODE A")
|
| 667 |
* ```
|
| 668 |
*
|
| 669 |
+
* @category transforming
|
| 670 |
+
* @since 3.18.0
|
| 671 |
*/
|
| 672 |
export const mapNodes = (mutable, f) => {
|
| 673 |
// Transform existing node data in place
|
|
|
|
| 679 |
/**
|
| 680 |
* Transforms all edge data in a mutable graph using the provided mapping function.
|
| 681 |
*
|
| 682 |
+
* **Example** (Mapping edge data)
|
| 683 |
+
*
|
| 684 |
* ```ts
|
| 685 |
* import { Graph } from "effect"
|
| 686 |
*
|
|
|
|
| 694 |
* })
|
| 695 |
*
|
| 696 |
* const edgeData = Graph.getEdge(graph, 0)
|
| 697 |
+
* console.log(edgeData) // Option.some(new Graph.Edge({ source: 0, target: 1, data: 20 }))
|
| 698 |
* ```
|
| 699 |
*
|
| 700 |
+
* @category transforming
|
| 701 |
+
* @since 3.18.0
|
| 702 |
*/
|
| 703 |
export const mapEdges = (mutable, f) => {
|
| 704 |
// Transform existing edge data in place
|
|
|
|
| 711 |
}
|
| 712 |
};
|
| 713 |
/**
|
| 714 |
+
* @internal
|
| 715 |
+
*/
|
| 716 |
+
const rebuildAdjacency = mutable => {
|
| 717 |
+
mutable.adjacency.clear();
|
| 718 |
+
mutable.reverseAdjacency.clear();
|
| 719 |
+
for (const nodeIndex of mutable.nodes.keys()) {
|
| 720 |
+
mutable.adjacency.set(nodeIndex, []);
|
| 721 |
+
mutable.reverseAdjacency.set(nodeIndex, []);
|
| 722 |
+
}
|
| 723 |
+
for (const [edgeIndex, edgeData] of mutable.edges) {
|
| 724 |
+
mutable.adjacency.get(edgeData.source).push(edgeIndex);
|
| 725 |
+
mutable.reverseAdjacency.get(edgeData.target).push(edgeIndex);
|
| 726 |
+
if (mutable.type === "undirected") {
|
| 727 |
+
mutable.adjacency.get(edgeData.target).push(edgeIndex);
|
| 728 |
+
mutable.reverseAdjacency.get(edgeData.source).push(edgeIndex);
|
| 729 |
+
}
|
| 730 |
+
}
|
| 731 |
+
};
|
| 732 |
+
/**
|
| 733 |
+
* Swaps source and target nodes for every edge in a mutable graph.
|
| 734 |
+
*
|
| 735 |
+
* **Example** (Reversing edge directions)
|
| 736 |
*
|
|
|
|
| 737 |
* ```ts
|
| 738 |
* import { Graph } from "effect"
|
| 739 |
*
|
|
|
|
| 747 |
* })
|
| 748 |
*
|
| 749 |
* const edge0 = Graph.getEdge(graph, 0)
|
| 750 |
+
* console.log(edge0) // Option.some(new Graph.Edge({ source: 1, target: 0, data: 1 }))
|
| 751 |
* ```
|
| 752 |
*
|
| 753 |
+
* @category transforming
|
| 754 |
+
* @since 3.18.0
|
| 755 |
*/
|
| 756 |
export const reverse = mutable => {
|
| 757 |
+
if (mutable.type === "undirected") {
|
| 758 |
+
return;
|
| 759 |
+
}
|
| 760 |
// Reverse all edges by swapping source and target
|
| 761 |
for (const [index, edgeData] of mutable.edges) {
|
| 762 |
mutable.edges.set(index, new Edge({
|
|
|
|
| 765 |
data: edgeData.data
|
| 766 |
}));
|
| 767 |
}
|
| 768 |
+
rebuildAdjacency(mutable);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 769 |
// Invalidate cycle flag since edge directions changed
|
| 770 |
mutable.acyclic = Option.none();
|
| 771 |
};
|
|
|
|
| 773 |
* Filters and optionally transforms nodes in a mutable graph using a predicate function.
|
| 774 |
* Nodes that return Option.none are removed along with all their connected edges.
|
| 775 |
*
|
| 776 |
+
* **Example** (Filtering and mapping nodes)
|
| 777 |
+
*
|
| 778 |
* ```ts
|
| 779 |
+
* import { Graph, Option } from "effect"
|
|
|
|
| 780 |
*
|
| 781 |
* const graph = Graph.directed<string, number>((mutable) => {
|
| 782 |
* const a = Graph.addNode(mutable, "active")
|
|
|
|
| 796 |
* console.log(Graph.nodeCount(graph)) // 2 (only "active" nodes remain)
|
| 797 |
* ```
|
| 798 |
*
|
| 799 |
+
* @category transforming
|
| 800 |
+
* @since 3.18.0
|
| 801 |
*/
|
| 802 |
export const filterMapNodes = (mutable, f) => {
|
| 803 |
const nodesToRemove = [];
|
|
|
|
| 821 |
* Filters and optionally transforms edges in a mutable graph using a predicate function.
|
| 822 |
* Edges that return Option.none are removed from the graph.
|
| 823 |
*
|
| 824 |
+
* **Example** (Filtering and mapping edges)
|
| 825 |
+
*
|
| 826 |
* ```ts
|
| 827 |
+
* import { Graph, Option } from "effect"
|
|
|
|
| 828 |
*
|
| 829 |
* const graph = Graph.directed<string, number>((mutable) => {
|
| 830 |
* const a = Graph.addNode(mutable, "A")
|
|
|
|
| 844 |
* console.log(Graph.edgeCount(graph)) // 2 (edges with weight 5 removed)
|
| 845 |
* ```
|
| 846 |
*
|
| 847 |
+
* @category transforming
|
| 848 |
+
* @since 3.18.0
|
| 849 |
*/
|
| 850 |
export const filterMapEdges = (mutable, f) => {
|
| 851 |
const edgesToRemove = [];
|
|
|
|
| 872 |
* Filters nodes by removing those that don't match the predicate.
|
| 873 |
* This function modifies the mutable graph in place.
|
| 874 |
*
|
| 875 |
+
* **Example** (Filtering nodes)
|
| 876 |
+
*
|
| 877 |
* ```ts
|
| 878 |
* import { Graph } from "effect"
|
| 879 |
*
|
|
|
|
| 890 |
* console.log(Graph.nodeCount(graph)) // 2 (only "active" nodes remain)
|
| 891 |
* ```
|
| 892 |
*
|
| 893 |
+
* @category transforming
|
| 894 |
+
* @since 3.18.0
|
| 895 |
*/
|
| 896 |
export const filterNodes = (mutable, predicate) => {
|
| 897 |
const nodesToRemove = [];
|
|
|
|
| 910 |
* Filters edges by removing those that don't match the predicate.
|
| 911 |
* This function modifies the mutable graph in place.
|
| 912 |
*
|
| 913 |
+
* **Example** (Filtering edges)
|
| 914 |
+
*
|
| 915 |
* ```ts
|
| 916 |
* import { Graph } from "effect"
|
| 917 |
*
|
|
|
|
| 931 |
* console.log(Graph.edgeCount(graph)) // 2 (edge with weight 5 removed)
|
| 932 |
* ```
|
| 933 |
*
|
| 934 |
+
* @category transforming
|
| 935 |
+
* @since 3.18.0
|
| 936 |
*/
|
| 937 |
export const filterEdges = (mutable, predicate) => {
|
| 938 |
const edgesToRemove = [];
|
|
|
|
| 970 |
/**
|
| 971 |
* Adds a new edge to a mutable graph and returns its index.
|
| 972 |
*
|
| 973 |
+
* **When to use**
|
| 974 |
+
*
|
| 975 |
+
* Use to connect two existing nodes in a mutable graph while storing edge data
|
| 976 |
+
* and receiving the new edge identifier.
|
| 977 |
+
*
|
| 978 |
+
* **Details**
|
| 979 |
+
*
|
| 980 |
+
* Creates an `Edge` with the source, target, and data at the next edge index,
|
| 981 |
+
* updates adjacency indexes, and increments the graph's next edge index.
|
| 982 |
+
* Undirected graphs register the same edge for both endpoints.
|
| 983 |
+
*
|
| 984 |
+
* **Gotchas**
|
| 985 |
+
*
|
| 986 |
+
* The source and target nodes must already exist in the mutable graph; missing
|
| 987 |
+
* endpoints throw a `GraphError`.
|
| 988 |
+
*
|
| 989 |
+
* **Example** (Adding edges)
|
| 990 |
+
*
|
| 991 |
* ```ts
|
| 992 |
* import { Graph } from "effect"
|
| 993 |
*
|
|
|
|
| 999 |
* })
|
| 1000 |
* ```
|
| 1001 |
*
|
| 1002 |
+
* @see {@link mutate} for obtaining a mutable graph from an immutable graph
|
| 1003 |
+
* @see {@link addNode} for creating node indexes before connecting them
|
| 1004 |
+
* @see {@link getEdge} for reading the returned edge
|
| 1005 |
+
* @see {@link removeEdge} for removing an edge from a mutable graph
|
| 1006 |
+
*
|
| 1007 |
* @category mutations
|
| 1008 |
+
* @since 3.18.0
|
| 1009 |
*/
|
| 1010 |
export const addEdge = (mutable, source, target, data) => {
|
| 1011 |
// Validate that both nodes exist
|
|
|
|
| 1053 |
/**
|
| 1054 |
* Removes a node and all its incident edges from a mutable graph.
|
| 1055 |
*
|
| 1056 |
+
* **Example** (Removing a node)
|
| 1057 |
+
*
|
| 1058 |
* ```ts
|
| 1059 |
* import { Graph } from "effect"
|
| 1060 |
*
|
|
|
|
| 1068 |
* })
|
| 1069 |
* ```
|
| 1070 |
*
|
|
|
|
| 1071 |
* @category mutations
|
| 1072 |
+
* @since 3.18.0
|
| 1073 |
*/
|
| 1074 |
export const removeNode = (mutable, nodeIndex) => {
|
| 1075 |
// Check if node exists
|
|
|
|
| 1107 |
/**
|
| 1108 |
* Removes an edge from a mutable graph.
|
| 1109 |
*
|
| 1110 |
+
* **Example** (Removing an edge)
|
| 1111 |
+
*
|
| 1112 |
* ```ts
|
| 1113 |
* import { Graph } from "effect"
|
| 1114 |
*
|
|
|
|
| 1122 |
* })
|
| 1123 |
* ```
|
| 1124 |
*
|
|
|
|
| 1125 |
* @category mutations
|
| 1126 |
+
* @since 3.18.0
|
| 1127 |
*/
|
| 1128 |
export const removeEdge = (mutable, edgeIndex) => {
|
| 1129 |
const wasRemoved = removeEdgeInternal(mutable, edgeIndex);
|
|
|
|
| 1184 |
// Edge Query Operations
|
| 1185 |
// =============================================================================
|
| 1186 |
/**
|
| 1187 |
+
* Gets the edge data associated with an edge index safely, if it exists.
|
| 1188 |
+
*
|
| 1189 |
+
* **Example** (Getting edge data)
|
| 1190 |
*
|
|
|
|
| 1191 |
* ```ts
|
| 1192 |
* import { Graph } from "effect"
|
| 1193 |
*
|
|
|
|
| 1202 |
*
|
| 1203 |
* if (edgeData._tag === "Some") {
|
| 1204 |
* console.log(edgeData.value.data) // 42
|
| 1205 |
+
* console.log(edgeData.value.source) // 0
|
| 1206 |
+
* console.log(edgeData.value.target) // 1
|
| 1207 |
* }
|
| 1208 |
* ```
|
| 1209 |
*
|
|
|
|
| 1210 |
* @category getters
|
| 1211 |
+
* @since 3.18.0
|
| 1212 |
*/
|
| 1213 |
export const getEdge = /*#__PURE__*/dual(2, (graph, edgeIndex) => Option.fromUndefinedOr(graph.edges.get(edgeIndex)));
|
| 1214 |
/**
|
| 1215 |
+
* Checks whether an edge exists between two nodes in the graph.
|
| 1216 |
+
*
|
| 1217 |
+
* **Example** (Checking edge existence)
|
| 1218 |
*
|
|
|
|
| 1219 |
* ```ts
|
| 1220 |
* import { Graph } from "effect"
|
| 1221 |
*
|
|
|
|
| 1237 |
* console.log(hasAC) // false
|
| 1238 |
* ```
|
| 1239 |
*
|
|
|
|
| 1240 |
* @category getters
|
| 1241 |
+
* @since 3.18.0
|
| 1242 |
*/
|
| 1243 |
export const hasEdge = /*#__PURE__*/dual(3, (graph, source, target) => {
|
| 1244 |
const adjacencyList = graph.adjacency.get(source);
|
|
|
|
| 1248 |
// Check if any edge in the adjacency list connects to the target
|
| 1249 |
for (const edgeIndex of adjacencyList) {
|
| 1250 |
const edge = graph.edges.get(edgeIndex);
|
| 1251 |
+
if (edge !== undefined) {
|
| 1252 |
+
const neighbor = graph.type === "undirected" && edge.target === source ? edge.source : edge.target;
|
| 1253 |
+
if (neighbor === target) {
|
| 1254 |
+
return true;
|
| 1255 |
+
}
|
| 1256 |
}
|
| 1257 |
}
|
| 1258 |
return false;
|
|
|
|
| 1260 |
/**
|
| 1261 |
* Returns the number of edges in the graph.
|
| 1262 |
*
|
| 1263 |
+
* **Example** (Counting edges)
|
| 1264 |
+
*
|
| 1265 |
* ```ts
|
| 1266 |
* import { Graph } from "effect"
|
| 1267 |
*
|
|
|
|
| 1280 |
* console.log(Graph.edgeCount(graphWithEdges)) // 3
|
| 1281 |
* ```
|
| 1282 |
*
|
|
|
|
| 1283 |
* @category getters
|
| 1284 |
+
* @since 3.18.0
|
| 1285 |
*/
|
| 1286 |
export const edgeCount = graph => graph.edges.size;
|
| 1287 |
+
const getDirectedNeighbors = (graph, nodeIndex, direction) => {
|
| 1288 |
+
const adjacencyMap = direction === "incoming" ? graph.reverseAdjacency : graph.adjacency;
|
| 1289 |
+
const adjacencyList = adjacencyMap.get(nodeIndex);
|
| 1290 |
+
if (adjacencyList === undefined) {
|
| 1291 |
+
return [];
|
| 1292 |
+
}
|
| 1293 |
+
const result = [];
|
| 1294 |
+
for (const edgeIndex of adjacencyList) {
|
| 1295 |
+
const edge = graph.edges.get(edgeIndex);
|
| 1296 |
+
if (edge !== undefined) {
|
| 1297 |
+
result.push(direction === "incoming" ? edge.source : edge.target);
|
| 1298 |
+
}
|
| 1299 |
+
}
|
| 1300 |
+
return result;
|
| 1301 |
+
};
|
| 1302 |
/**
|
| 1303 |
+
* Returns the neighboring node indices for a node.
|
| 1304 |
+
*
|
| 1305 |
+
* **Details**
|
| 1306 |
+
*
|
| 1307 |
+
* For directed graphs, neighbors are the targets of outgoing edges. For
|
| 1308 |
+
* undirected graphs, neighbors are the other endpoints of incident edges.
|
| 1309 |
+
*
|
| 1310 |
+
* **Example** (Getting outgoing neighbors)
|
| 1311 |
*
|
|
|
|
| 1312 |
* ```ts
|
| 1313 |
* import { Graph } from "effect"
|
| 1314 |
*
|
|
|
|
| 1325 |
* const nodeC = 2
|
| 1326 |
*
|
| 1327 |
* const neighborsA = Graph.neighbors(graph, nodeA)
|
| 1328 |
+
* console.log(neighborsA) // [1, 2]
|
| 1329 |
*
|
| 1330 |
* const neighborsB = Graph.neighbors(graph, nodeB)
|
| 1331 |
* console.log(neighborsB) // []
|
| 1332 |
* ```
|
| 1333 |
*
|
|
|
|
| 1334 |
* @category getters
|
| 1335 |
+
* @since 3.18.0
|
| 1336 |
*/
|
| 1337 |
export const neighbors = /*#__PURE__*/dual(2, (graph, nodeIndex) => {
|
| 1338 |
// For undirected graphs, use the specialized helper that returns the other endpoint
|
| 1339 |
if (graph.type === "undirected") {
|
| 1340 |
return getUndirectedNeighbors(graph, nodeIndex);
|
| 1341 |
}
|
| 1342 |
+
return getDirectedNeighbors(graph, nodeIndex, "outgoing");
|
| 1343 |
+
});
|
| 1344 |
+
/**
|
| 1345 |
+
* Returns the outgoing neighbor node indices for a node in a directed graph.
|
| 1346 |
+
*
|
| 1347 |
+
* **When to use**
|
| 1348 |
+
*
|
| 1349 |
+
* Use when you need the nodes reached by following outgoing edges from a node in
|
| 1350 |
+
* a directed graph.
|
| 1351 |
+
*
|
| 1352 |
+
* **Gotchas**
|
| 1353 |
+
*
|
| 1354 |
+
* Throws a `GraphError` when used with an undirected graph.
|
| 1355 |
+
*
|
| 1356 |
+
* @see {@link predecessors} for incoming neighbors in a directed graph
|
| 1357 |
+
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
| 1358 |
+
*
|
| 1359 |
+
* @category queries
|
| 1360 |
+
* @since 4.0.0
|
| 1361 |
+
*/
|
| 1362 |
+
export const successors = /*#__PURE__*/dual(2, (graph, nodeIndex) => {
|
| 1363 |
+
if (graph.type === "undirected") {
|
| 1364 |
+
throw new GraphError({
|
| 1365 |
+
message: "Cannot get successors of undirected graph"
|
| 1366 |
+
});
|
| 1367 |
}
|
| 1368 |
+
return getDirectedNeighbors(graph, nodeIndex, "outgoing");
|
| 1369 |
+
});
|
| 1370 |
+
/**
|
| 1371 |
+
* Returns the incoming neighbor node indices for a node in a directed graph.
|
| 1372 |
+
*
|
| 1373 |
+
* **When to use**
|
| 1374 |
+
*
|
| 1375 |
+
* Use when you need the nodes that reach a node by following incoming edges in a
|
| 1376 |
+
* directed graph.
|
| 1377 |
+
*
|
| 1378 |
+
* **Gotchas**
|
| 1379 |
+
*
|
| 1380 |
+
* Throws a `GraphError` when used with an undirected graph.
|
| 1381 |
+
*
|
| 1382 |
+
* @see {@link successors} for outgoing neighbors in a directed graph
|
| 1383 |
+
* @see {@link neighbors} for generic neighbor lookup across graph kinds
|
| 1384 |
+
*
|
| 1385 |
+
* @category queries
|
| 1386 |
+
* @since 4.0.0
|
| 1387 |
+
*/
|
| 1388 |
+
export const predecessors = /*#__PURE__*/dual(2, (graph, nodeIndex) => {
|
| 1389 |
+
if (graph.type === "undirected") {
|
| 1390 |
+
throw new GraphError({
|
| 1391 |
+
message: "Cannot get predecessors of undirected graph"
|
| 1392 |
+
});
|
| 1393 |
}
|
| 1394 |
+
return getDirectedNeighbors(graph, nodeIndex, "incoming");
|
| 1395 |
});
|
| 1396 |
/**
|
| 1397 |
+
* Gets directed neighbors of a node in a specific direction.
|
| 1398 |
+
*
|
| 1399 |
+
* **When to use**
|
| 1400 |
+
*
|
| 1401 |
+
* Use when maintaining existing code that already passes an explicit traversal
|
| 1402 |
+
* direction. New code should prefer `successors` or `predecessors`.
|
| 1403 |
+
*
|
| 1404 |
+
* **Gotchas**
|
| 1405 |
+
*
|
| 1406 |
+
* Throws a `GraphError` when used with an undirected graph.
|
| 1407 |
+
*
|
| 1408 |
+
* **Example** (Traversing directed neighbors)
|
| 1409 |
*
|
|
|
|
| 1410 |
* ```ts
|
| 1411 |
* import { Graph } from "effect"
|
| 1412 |
*
|
|
|
|
| 1426 |
* const incoming = Graph.neighborsDirected(graph, nodeB, "incoming")
|
| 1427 |
* ```
|
| 1428 |
*
|
| 1429 |
+
* @deprecated Use {@link successors} for outgoing neighbors or {@link predecessors} for incoming neighbors.
|
| 1430 |
+
* @see {@link successors} for outgoing neighbors in a directed graph
|
| 1431 |
+
* @see {@link predecessors} for incoming neighbors in a directed graph
|
| 1432 |
* @category queries
|
| 1433 |
+
* @since 3.18.0
|
| 1434 |
*/
|
| 1435 |
export const neighborsDirected = /*#__PURE__*/dual(3, (graph, nodeIndex, direction) => {
|
| 1436 |
+
if (graph.type === "undirected") {
|
| 1437 |
+
throw new GraphError({
|
| 1438 |
+
message: "Cannot get directed neighbors of undirected graph"
|
| 1439 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1440 |
}
|
| 1441 |
+
return getDirectedNeighbors(graph, nodeIndex, direction);
|
| 1442 |
});
|
| 1443 |
/**
|
| 1444 |
* Exports a graph to GraphViz DOT format for visualization.
|
| 1445 |
*
|
| 1446 |
+
* **Example** (Exporting GraphViz DOT)
|
| 1447 |
+
*
|
| 1448 |
* ```ts
|
| 1449 |
* import { Graph } from "effect"
|
| 1450 |
*
|
|
|
|
| 1469 |
* // }
|
| 1470 |
* ```
|
| 1471 |
*
|
| 1472 |
+
* @category converting
|
| 1473 |
+
* @since 3.18.0
|
| 1474 |
*/
|
| 1475 |
export const toGraphViz = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, options) => {
|
| 1476 |
const {
|
|
|
|
| 1533 |
/**
|
| 1534 |
* Exports a graph to Mermaid diagram format for visualization.
|
| 1535 |
*
|
| 1536 |
+
* **Details**
|
| 1537 |
+
*
|
| 1538 |
* Mermaid is a popular diagram-as-code tool that generates flowcharts and other
|
| 1539 |
* visualizations from text-based definitions. This function converts Effect Graph
|
| 1540 |
* structures to valid Mermaid syntax for use in documentation, web applications,
|
| 1541 |
* and visualization tools.
|
| 1542 |
*
|
| 1543 |
+
* **Example** (Exporting a directed Mermaid diagram)
|
| 1544 |
+
*
|
| 1545 |
* ```ts
|
| 1546 |
+
* import { Graph } from "effect"
|
| 1547 |
*
|
| 1548 |
* // Basic directed graph export
|
| 1549 |
* const graph = Graph.directed<string, number>((mutable) => {
|
|
|
|
| 1564 |
* // 0 -->|"2"| 2
|
| 1565 |
* ```
|
| 1566 |
*
|
| 1567 |
+
* **Example** (Exporting an undirected Mermaid diagram)
|
| 1568 |
+
*
|
| 1569 |
* ```ts
|
| 1570 |
+
* import { Graph } from "effect"
|
| 1571 |
*
|
| 1572 |
* // Undirected graph with custom labels and direction
|
| 1573 |
* const socialGraph = Graph.undirected<{ name: string }, string>((mutable) => {
|
|
|
|
| 1592 |
* // 1 ---|"colleagues"| 2
|
| 1593 |
* ```
|
| 1594 |
*
|
| 1595 |
+
* **Example** (Customizing Mermaid node shapes)
|
| 1596 |
+
*
|
| 1597 |
* ```ts
|
| 1598 |
+
* import { Graph } from "effect"
|
| 1599 |
*
|
| 1600 |
* // Advanced styling with node shapes for flowchart
|
| 1601 |
* const workflow = Graph.directed<{ type: string; name: string }, string>(
|
|
|
|
| 1644 |
* // 2 --> 3
|
| 1645 |
* ```
|
| 1646 |
*
|
| 1647 |
+
* **Example** (Visualizing dependency graphs)
|
| 1648 |
+
*
|
| 1649 |
* ```ts
|
| 1650 |
+
* import { Graph } from "effect"
|
| 1651 |
*
|
| 1652 |
* // Real-world example: Software dependency graph
|
| 1653 |
* interface Dependency {
|
|
|
|
| 1706 |
* // 0 -->|"builds with"| 3
|
| 1707 |
* ```
|
| 1708 |
*
|
| 1709 |
+
* @category converting
|
| 1710 |
+
* @since 3.18.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1711 |
*/
|
| 1712 |
export const toMermaid = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, options) => {
|
| 1713 |
// Extract and validate options with defaults
|
|
|
|
| 1749 |
// Graph Structure Analysis Algorithms
|
| 1750 |
// =============================================================================
|
| 1751 |
/**
|
| 1752 |
+
* Checks whether the graph is acyclic (contains no cycles).
|
| 1753 |
+
*
|
| 1754 |
+
* **Details**
|
| 1755 |
*
|
| 1756 |
* Uses depth-first search to detect back edges, which indicate cycles.
|
| 1757 |
* For directed graphs, any back edge creates a cycle. For undirected graphs,
|
| 1758 |
* a back edge that doesn't go to the immediate parent creates a cycle.
|
| 1759 |
*
|
| 1760 |
+
* **Example** (Checking cycles)
|
| 1761 |
+
*
|
| 1762 |
* ```ts
|
| 1763 |
* import { Graph } from "effect"
|
| 1764 |
*
|
|
|
|
| 1782 |
* console.log(Graph.isAcyclic(cyclic)) // false
|
| 1783 |
* ```
|
| 1784 |
*
|
|
|
|
| 1785 |
* @category algorithms
|
| 1786 |
+
* @since 3.18.0
|
| 1787 |
*/
|
| 1788 |
export const isAcyclic = graph => {
|
| 1789 |
// Use existing cycle flag if available
|
| 1790 |
if (Option.isSome(graph.acyclic)) {
|
| 1791 |
return graph.acyclic.value;
|
| 1792 |
}
|
| 1793 |
+
if (graph.type === "undirected") {
|
| 1794 |
+
const visited = new Set();
|
| 1795 |
+
for (const startNode of graph.nodes.keys()) {
|
| 1796 |
+
if (visited.has(startNode)) {
|
| 1797 |
+
continue;
|
| 1798 |
+
}
|
| 1799 |
+
visited.add(startNode);
|
| 1800 |
+
const stack = [{
|
| 1801 |
+
node: startNode,
|
| 1802 |
+
parent: null
|
| 1803 |
+
}];
|
| 1804 |
+
while (stack.length > 0) {
|
| 1805 |
+
const {
|
| 1806 |
+
node,
|
| 1807 |
+
parent
|
| 1808 |
+
} = stack.pop();
|
| 1809 |
+
const nodeNeighbors = getUndirectedNeighbors(graph, node);
|
| 1810 |
+
for (const neighbor of nodeNeighbors) {
|
| 1811 |
+
if (!visited.has(neighbor)) {
|
| 1812 |
+
visited.add(neighbor);
|
| 1813 |
+
stack.push({
|
| 1814 |
+
node: neighbor,
|
| 1815 |
+
parent: node
|
| 1816 |
+
});
|
| 1817 |
+
} else if (neighbor !== parent) {
|
| 1818 |
+
graph.acyclic = Option.some(false);
|
| 1819 |
+
return false;
|
| 1820 |
+
}
|
| 1821 |
+
}
|
| 1822 |
+
}
|
| 1823 |
+
}
|
| 1824 |
+
graph.acyclic = Option.some(true);
|
| 1825 |
+
return true;
|
| 1826 |
+
}
|
| 1827 |
// Stack-safe DFS cycle detection using iterative approach
|
| 1828 |
const visited = new Set();
|
| 1829 |
const recursionStack = new Set();
|
|
|
|
| 1850 |
visited.add(node);
|
| 1851 |
recursionStack.add(node);
|
| 1852 |
// Get neighbors for this node
|
| 1853 |
+
const nodeNeighbors = getDirectedNeighbors(graph, node, "outgoing");
|
| 1854 |
stack[stack.length - 1] = [node, nodeNeighbors, 0, false];
|
| 1855 |
continue;
|
| 1856 |
}
|
|
|
|
| 1878 |
return true;
|
| 1879 |
};
|
| 1880 |
/**
|
| 1881 |
+
* Checks whether an undirected graph is bipartite.
|
| 1882 |
+
*
|
| 1883 |
+
* **Details**
|
| 1884 |
*
|
| 1885 |
* A bipartite graph is one whose vertices can be divided into two disjoint sets
|
| 1886 |
* such that no two vertices within the same set are adjacent. Uses BFS coloring
|
| 1887 |
* to determine bipartiteness.
|
| 1888 |
*
|
| 1889 |
+
* **Example** (Checking bipartite graphs)
|
| 1890 |
+
*
|
| 1891 |
* ```ts
|
| 1892 |
* import { Graph } from "effect"
|
| 1893 |
*
|
|
|
|
| 1915 |
* console.log(Graph.isBipartite(triangle)) // false
|
| 1916 |
* ```
|
| 1917 |
*
|
|
|
|
| 1918 |
* @category algorithms
|
| 1919 |
+
* @since 3.18.0
|
| 1920 |
*/
|
| 1921 |
export const isBipartite = graph => {
|
| 1922 |
const coloring = new Map();
|
|
|
|
| 1978 |
}
|
| 1979 |
return Array.from(neighbors);
|
| 1980 |
};
|
| 1981 |
+
const getTraversalNeighbors = (graph, nodeIndex, direction) => graph.type === "undirected" ? getUndirectedNeighbors(graph, nodeIndex) : getDirectedNeighbors(graph, nodeIndex, direction);
|
| 1982 |
+
const getTraversableNeighbor = (graph, current, edge) => graph.type === "undirected" && edge.target === current ? edge.source : edge.target;
|
| 1983 |
/**
|
| 1984 |
+
* Finds connected components in an undirected graph.
|
| 1985 |
* Each component is represented as an array of node indices.
|
| 1986 |
*
|
| 1987 |
+
* **Example** (Finding connected components)
|
| 1988 |
+
*
|
| 1989 |
* ```ts
|
| 1990 |
* import { Graph } from "effect"
|
| 1991 |
*
|
|
|
|
| 2002 |
* console.log(components) // [[0, 1], [2, 3]]
|
| 2003 |
* ```
|
| 2004 |
*
|
|
|
|
| 2005 |
* @category algorithms
|
| 2006 |
+
* @since 3.18.0
|
| 2007 |
*/
|
| 2008 |
export const connectedComponents = graph => {
|
| 2009 |
const visited = new Set();
|
|
|
|
| 2033 |
return components;
|
| 2034 |
};
|
| 2035 |
/**
|
| 2036 |
+
* Finds strongly connected components in a directed graph using Kosaraju's algorithm.
|
| 2037 |
* Each SCC is represented as an array of node indices.
|
| 2038 |
*
|
| 2039 |
+
* **Gotchas**
|
| 2040 |
+
*
|
| 2041 |
+
* Throws a `GraphError` when used with an undirected graph.
|
| 2042 |
+
*
|
| 2043 |
+
* **Example** (Finding strongly connected components)
|
| 2044 |
+
*
|
| 2045 |
* ```ts
|
| 2046 |
* import { Graph } from "effect"
|
| 2047 |
*
|
|
|
|
| 2058 |
* console.log(sccs) // [[0, 1, 2]]
|
| 2059 |
* ```
|
| 2060 |
*
|
|
|
|
| 2061 |
* @category algorithms
|
| 2062 |
+
* @since 3.18.0
|
| 2063 |
*/
|
| 2064 |
export const stronglyConnectedComponents = graph => {
|
| 2065 |
+
if (graph.type === "undirected") {
|
| 2066 |
+
throw new GraphError({
|
| 2067 |
+
message: "Cannot find strongly connected components of undirected graph"
|
| 2068 |
+
});
|
| 2069 |
+
}
|
| 2070 |
const visited = new Set();
|
| 2071 |
const finishOrder = [];
|
| 2072 |
for (const startNode of graph.nodes.keys()) {
|
|
|
|
| 2082 |
continue;
|
| 2083 |
}
|
| 2084 |
visited.add(node);
|
| 2085 |
+
const nodeNeighborsList = getDirectedNeighbors(graph, node, "outgoing");
|
| 2086 |
stack[stack.length - 1] = [node, nodeNeighborsList, 0, false];
|
| 2087 |
continue;
|
| 2088 |
}
|
|
|
|
| 2135 |
}
|
| 2136 |
return sccs;
|
| 2137 |
};
|
| 2138 |
+
const validateNonNegativeEdgeWeights = (graph, cost, algorithm) => {
|
| 2139 |
+
const edgeWeights = new Map();
|
| 2140 |
+
for (const [edgeIndex, edgeData] of graph.edges) {
|
| 2141 |
+
const weight = cost(edgeData.data);
|
| 2142 |
+
if (weight < 0 || Number.isNaN(weight)) {
|
| 2143 |
+
throw new GraphError({
|
| 2144 |
+
message: `${algorithm} requires non-negative edge weights`
|
| 2145 |
+
});
|
| 2146 |
+
}
|
| 2147 |
+
edgeWeights.set(edgeIndex, weight);
|
| 2148 |
+
}
|
| 2149 |
+
return edgeWeights;
|
| 2150 |
+
};
|
| 2151 |
/**
|
| 2152 |
+
* Finds the shortest path from the configured source node to the target node
|
| 2153 |
+
* using Dijkstra's algorithm.
|
| 2154 |
+
*
|
| 2155 |
+
* **Details**
|
| 2156 |
+
*
|
| 2157 |
+
* Edge costs must be non-negative. Returns `Option.none()` when the target is
|
| 2158 |
+
* not reachable, and throws a `GraphError` when either endpoint is missing or a
|
| 2159 |
+
* negative edge cost is encountered.
|
| 2160 |
*
|
| 2161 |
+
* **Example** (Finding shortest paths with Dijkstra)
|
|
|
|
| 2162 |
*
|
|
|
|
| 2163 |
* ```ts
|
| 2164 |
* import { Graph } from "effect"
|
| 2165 |
*
|
|
|
|
| 2184 |
* }
|
| 2185 |
* ```
|
| 2186 |
*
|
|
|
|
| 2187 |
* @category algorithms
|
| 2188 |
+
* @since 3.18.0
|
| 2189 |
*/
|
| 2190 |
export const dijkstra = /*#__PURE__*/dual(2, (graph, config) => {
|
| 2191 |
// Validate that source and target nodes exist
|
|
|
|
| 2195 |
if (!graph.nodes.has(config.target)) {
|
| 2196 |
throw missingNode(config.target);
|
| 2197 |
}
|
| 2198 |
+
const edgeWeights = validateNonNegativeEdgeWeights(graph, config.cost, "Dijkstra's algorithm");
|
| 2199 |
// Early return if source equals target
|
| 2200 |
if (config.source === config.target) {
|
| 2201 |
return Option.some({
|
|
|
|
| 2246 |
for (const edgeIndex of adjacencyList) {
|
| 2247 |
const edge = graph.edges.get(edgeIndex);
|
| 2248 |
if (edge !== undefined) {
|
| 2249 |
+
const neighbor = getTraversableNeighbor(graph, currentNode, edge);
|
| 2250 |
+
const cost = edgeWeights.get(edgeIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2251 |
const newDistance = currentDistance + cost;
|
| 2252 |
const neighborDistance = distances.get(neighbor);
|
| 2253 |
// Relaxation step
|
|
|
|
| 2295 |
});
|
| 2296 |
});
|
| 2297 |
/**
|
| 2298 |
+
* Finds shortest paths between all pairs of nodes using the Floyd-Warshall
|
| 2299 |
+
* algorithm.
|
| 2300 |
*
|
| 2301 |
+
* **Details**
|
|
|
|
| 2302 |
*
|
| 2303 |
+
* Computes distances, reconstructed node paths, and edge-data paths for every
|
| 2304 |
+
* source and target pair in O(V^3) time. Negative edge weights are allowed, but
|
| 2305 |
+
* a `GraphError` is thrown if any negative cycle is detected.
|
| 2306 |
+
*
|
| 2307 |
+
* **Example** (Finding all-pairs shortest paths)
|
| 2308 |
*
|
|
|
|
| 2309 |
* ```ts
|
| 2310 |
* import { Graph } from "effect"
|
| 2311 |
*
|
|
|
|
| 2323 |
* const pathAToC = result.paths.get(0)?.get(2) // [0, 1, 2]
|
| 2324 |
* ```
|
| 2325 |
*
|
|
|
|
| 2326 |
* @category algorithms
|
| 2327 |
+
* @since 3.18.0
|
| 2328 |
*/
|
| 2329 |
export const floydWarshall = /*#__PURE__*/dual(2, (graph, cost) => {
|
| 2330 |
// Get all nodes for Floyd-Warshall algorithm (needs array for nested iteration)
|
|
|
|
| 2356 |
next.get(i).set(j, j);
|
| 2357 |
edgeMatrix.get(i).set(j, edgeData.data);
|
| 2358 |
}
|
| 2359 |
+
if (graph.type === "undirected") {
|
| 2360 |
+
const reverseWeight = distances.get(j).get(i);
|
| 2361 |
+
if (weight < reverseWeight) {
|
| 2362 |
+
distances.get(j).set(i, weight);
|
| 2363 |
+
next.get(j).set(i, i);
|
| 2364 |
+
edgeMatrix.get(j).set(i, edgeData.data);
|
| 2365 |
+
}
|
| 2366 |
+
}
|
| 2367 |
}
|
| 2368 |
// Floyd-Warshall main loop
|
| 2369 |
for (const k of allNodes) {
|
|
|
|
| 2428 |
};
|
| 2429 |
});
|
| 2430 |
/**
|
| 2431 |
+
* Finds the shortest path from the configured source node to the target node
|
| 2432 |
+
* using the A* pathfinding algorithm.
|
| 2433 |
+
*
|
| 2434 |
+
* **Details**
|
| 2435 |
+
*
|
| 2436 |
+
* The edge-cost function must return non-negative weights, and the heuristic
|
| 2437 |
+
* should be consistent to preserve shortest-path guarantees. Returns
|
| 2438 |
+
* `Option.none()` when the target is not reachable, and throws a `GraphError`
|
| 2439 |
+
* when either endpoint is missing or a negative edge cost is encountered.
|
| 2440 |
*
|
| 2441 |
+
* **Example** (Finding shortest paths with A-star)
|
|
|
|
|
|
|
| 2442 |
*
|
|
|
|
| 2443 |
* ```ts
|
| 2444 |
* import { Graph } from "effect"
|
| 2445 |
*
|
|
|
|
| 2470 |
* }
|
| 2471 |
* ```
|
| 2472 |
*
|
|
|
|
| 2473 |
* @category algorithms
|
| 2474 |
+
* @since 3.18.0
|
| 2475 |
*/
|
| 2476 |
export const astar = /*#__PURE__*/dual(2, (graph, config) => {
|
| 2477 |
// Validate that source and target nodes exist
|
|
|
|
| 2481 |
if (!graph.nodes.has(config.target)) {
|
| 2482 |
throw missingNode(config.target);
|
| 2483 |
}
|
| 2484 |
+
const edgeWeights = validateNonNegativeEdgeWeights(graph, config.cost, "A* algorithm");
|
| 2485 |
// Early return if source equals target
|
| 2486 |
if (config.source === config.target) {
|
| 2487 |
return Option.some({
|
|
|
|
| 2547 |
for (const edgeIndex of adjacencyList) {
|
| 2548 |
const edge = graph.edges.get(edgeIndex);
|
| 2549 |
if (edge !== undefined) {
|
| 2550 |
+
const neighbor = getTraversableNeighbor(graph, currentNode, edge);
|
| 2551 |
+
const weight = edgeWeights.get(edgeIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2552 |
const tentativeGScore = currentGScore + weight;
|
| 2553 |
const neighborGScore = gScore.get(neighbor);
|
| 2554 |
// If this path to neighbor is better than any previous one
|
|
|
|
| 2604 |
});
|
| 2605 |
});
|
| 2606 |
/**
|
| 2607 |
+
* Finds the shortest path from the configured source node to the target node
|
| 2608 |
+
* using the Bellman-Ford algorithm.
|
| 2609 |
+
*
|
| 2610 |
+
* **Details**
|
| 2611 |
+
*
|
| 2612 |
+
* Negative edge weights are allowed. Returns `Option.none()` when the target is
|
| 2613 |
+
* unreachable or when a negative cycle affects the path to the target. Throws a
|
| 2614 |
+
* `GraphError` when either endpoint is missing.
|
| 2615 |
*
|
| 2616 |
+
* **Example** (Finding shortest paths with Bellman-Ford)
|
|
|
|
|
|
|
| 2617 |
*
|
|
|
|
| 2618 |
* ```ts
|
| 2619 |
* import { Graph } from "effect"
|
| 2620 |
*
|
|
|
|
| 2639 |
* }
|
| 2640 |
* ```
|
| 2641 |
*
|
|
|
|
| 2642 |
* @category algorithms
|
| 2643 |
+
* @since 3.18.0
|
| 2644 |
*/
|
| 2645 |
export const bellmanFord = /*#__PURE__*/dual(2, (graph, config) => {
|
| 2646 |
// Validate that source and target nodes exist
|
|
|
|
| 2676 |
weight,
|
| 2677 |
edgeData: edgeData.data
|
| 2678 |
});
|
| 2679 |
+
if (graph.type === "undirected" && edgeData.source !== edgeData.target) {
|
| 2680 |
+
edges.push({
|
| 2681 |
+
source: edgeData.target,
|
| 2682 |
+
target: edgeData.source,
|
| 2683 |
+
weight,
|
| 2684 |
+
edgeData: edgeData.data
|
| 2685 |
+
});
|
| 2686 |
+
}
|
| 2687 |
}
|
| 2688 |
// Relax edges up to V-1 times
|
| 2689 |
const nodeCount = graph.nodes.size;
|
|
|
|
| 2720 |
if (affectedNodes.has(node)) continue;
|
| 2721 |
affectedNodes.add(node);
|
| 2722 |
// Add all nodes reachable from this node
|
| 2723 |
+
for (const neighbor of getTraversalNeighbors(graph, node, "outgoing")) {
|
| 2724 |
+
queue.push(neighbor);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2725 |
}
|
| 2726 |
}
|
| 2727 |
// If target is affected by a negative cycle, no shortest path exists.
|
|
|
|
| 2756 |
});
|
| 2757 |
});
|
| 2758 |
/**
|
| 2759 |
+
* Represents an iterable wrapper used by graph traversal and listing APIs.
|
| 2760 |
*
|
| 2761 |
+
* **Details**
|
| 2762 |
+
*
|
| 2763 |
+
* A `Walker` yields `[index, data]` pairs lazily and can be viewed as just the
|
| 2764 |
+
* indices, just the values, or mapped entries with `indices`, `values`,
|
| 2765 |
+
* `entries`, and `visit`.
|
| 2766 |
+
*
|
| 2767 |
+
* **Example** (Working with node walkers)
|
| 2768 |
*
|
|
|
|
| 2769 |
* ```ts
|
| 2770 |
* import { Graph } from "effect"
|
| 2771 |
*
|
|
|
|
| 2789 |
* const nodeEntries = Array.from(Graph.entries(allNodes)) // [[0, "A"], [1, "B"]]
|
| 2790 |
* ```
|
| 2791 |
*
|
|
|
|
| 2792 |
* @category models
|
| 2793 |
+
* @since 3.18.0
|
| 2794 |
*/
|
| 2795 |
export class Walker {
|
| 2796 |
// @ts-ignore
|
|
|
|
| 2798 |
/**
|
| 2799 |
* Visits each element and maps it to a value using the provided function.
|
| 2800 |
*
|
| 2801 |
+
* **Details**
|
| 2802 |
+
*
|
| 2803 |
* Takes a function that receives the index and data,
|
| 2804 |
* and returns an iterable of the mapped values. Skips elements that
|
| 2805 |
* no longer exist in the graph.
|
| 2806 |
*
|
| 2807 |
+
* **Example** (Visiting walker elements)
|
| 2808 |
+
*
|
| 2809 |
* ```ts
|
| 2810 |
* import { Graph } from "effect"
|
| 2811 |
*
|
|
|
|
| 2829 |
* ```
|
| 2830 |
*
|
| 2831 |
* @since 4.0.0
|
|
|
|
| 2832 |
*/
|
| 2833 |
visit;
|
| 2834 |
constructor(
|
|
|
|
| 2839 |
* and returns an iterable of the mapped values. Skips elements that
|
| 2840 |
* no longer exist in the graph.
|
| 2841 |
*
|
| 2842 |
+
* **Example** (Visiting walker elements)
|
| 2843 |
+
*
|
| 2844 |
* ```ts
|
| 2845 |
* import { Graph } from "effect"
|
| 2846 |
*
|
|
|
|
| 2863 |
* console.log(custom) // [{ id: 0, name: "A" }, { id: 1, name: "B" }]
|
| 2864 |
* ```
|
| 2865 |
*
|
|
|
|
| 2866 |
* @category iterators
|
| 2867 |
+
* @since 4.0.0
|
| 2868 |
*/
|
| 2869 |
visit) {
|
| 2870 |
this.visit = visit;
|
|
|
|
| 2874 |
/**
|
| 2875 |
* Returns an iterator over the indices in the walker.
|
| 2876 |
*
|
| 2877 |
+
* **Example** (Iterating walker indices)
|
| 2878 |
+
*
|
| 2879 |
* ```ts
|
| 2880 |
* import { Graph } from "effect"
|
| 2881 |
*
|
|
|
|
| 2890 |
* console.log(indices) // [0, 1]
|
| 2891 |
* ```
|
| 2892 |
*
|
| 2893 |
+
* @category iterators
|
| 2894 |
+
* @since 3.18.0
|
| 2895 |
*/
|
| 2896 |
export const indices = walker => walker.visit((index, _) => index);
|
| 2897 |
/**
|
| 2898 |
* Returns an iterator over the values (data) in the walker.
|
| 2899 |
*
|
| 2900 |
+
* **Example** (Iterating walker values)
|
| 2901 |
+
*
|
| 2902 |
* ```ts
|
| 2903 |
* import { Graph } from "effect"
|
| 2904 |
*
|
|
|
|
| 2913 |
* console.log(values) // ["A", "B"]
|
| 2914 |
* ```
|
| 2915 |
*
|
| 2916 |
+
* @category iterators
|
| 2917 |
+
* @since 3.18.0
|
| 2918 |
*/
|
| 2919 |
export const values = walker => walker.visit((_, data) => data);
|
| 2920 |
/**
|
| 2921 |
* Returns an iterator over [index, data] entries in the walker.
|
| 2922 |
*
|
| 2923 |
+
* **Example** (Iterating walker entries)
|
| 2924 |
+
*
|
| 2925 |
* ```ts
|
| 2926 |
* import { Graph } from "effect"
|
| 2927 |
*
|
|
|
|
| 2936 |
* console.log(entries) // [[0, "A"], [1, "B"]]
|
| 2937 |
* ```
|
| 2938 |
*
|
| 2939 |
+
* @category iterators
|
| 2940 |
+
* @since 3.18.0
|
| 2941 |
*/
|
| 2942 |
export const entries = walker => walker.visit((index, data) => [index, data]);
|
| 2943 |
/**
|
| 2944 |
+
* Creates a lazy depth-first traversal iterator from the configured start
|
| 2945 |
+
* nodes.
|
| 2946 |
+
*
|
| 2947 |
+
* **Details**
|
| 2948 |
*
|
| 2949 |
+
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
| 2950 |
+
* chooses whether to follow outgoing or incoming edges. Throws a `GraphError`
|
| 2951 |
+
* if any configured start node does not exist.
|
| 2952 |
+
*
|
| 2953 |
+
* **Example** (Traversing depth-first)
|
| 2954 |
*
|
|
|
|
| 2955 |
* ```ts
|
| 2956 |
* import { Graph } from "effect"
|
| 2957 |
*
|
|
|
|
| 2974 |
* // Can be used programmatically
|
| 2975 |
* ```
|
| 2976 |
*
|
|
|
|
| 2977 |
* @category iterators
|
| 2978 |
+
* @since 3.18.0
|
| 2979 |
*/
|
| 2980 |
export const dfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 2981 |
const start = config.start ?? [];
|
|
|
|
| 3001 |
if (Option.isNone(nodeDataOption)) {
|
| 3002 |
continue;
|
| 3003 |
}
|
| 3004 |
+
const neighbors = getTraversalNeighbors(graph, current, direction);
|
| 3005 |
for (let i = neighbors.length - 1; i >= 0; i--) {
|
| 3006 |
const neighbor = neighbors[i];
|
| 3007 |
if (!discovered.has(neighbor)) {
|
|
|
|
| 3025 |
}));
|
| 3026 |
});
|
| 3027 |
/**
|
| 3028 |
+
* Creates a lazy breadth-first traversal iterator from the configured start
|
| 3029 |
+
* nodes.
|
| 3030 |
+
*
|
| 3031 |
+
* **Details**
|
| 3032 |
*
|
| 3033 |
+
* If no start nodes are supplied, the iterator is empty. The `direction` option
|
| 3034 |
+
* chooses whether to follow outgoing or incoming edges. Throws a `GraphError`
|
| 3035 |
+
* if any configured start node does not exist.
|
| 3036 |
+
*
|
| 3037 |
+
* **Example** (Traversing breadth-first)
|
| 3038 |
*
|
|
|
|
| 3039 |
* ```ts
|
| 3040 |
* import { Graph } from "effect"
|
| 3041 |
*
|
|
|
|
| 3058 |
* // Can be used programmatically
|
| 3059 |
* ```
|
| 3060 |
*
|
|
|
|
| 3061 |
* @category iterators
|
| 3062 |
+
* @since 3.18.0
|
| 3063 |
*/
|
| 3064 |
export const bfs = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 3065 |
const start = config.start ?? [];
|
|
|
|
| 3079 |
const current = queue.shift();
|
| 3080 |
if (!discovered.has(current)) {
|
| 3081 |
discovered.add(current);
|
| 3082 |
+
const neighbors = getTraversalNeighbors(graph, current, direction);
|
| 3083 |
for (const neighbor of neighbors) {
|
| 3084 |
if (!discovered.has(neighbor)) {
|
| 3085 |
queue.push(neighbor);
|
|
|
|
| 3109 |
/**
|
| 3110 |
* Creates a new topological sort iterator with optional configuration.
|
| 3111 |
*
|
| 3112 |
+
* **Details**
|
| 3113 |
+
*
|
| 3114 |
* The iterator uses Kahn's algorithm to lazily produce nodes in topological order.
|
| 3115 |
* Throws an error if the graph contains cycles.
|
| 3116 |
*
|
| 3117 |
+
* **Example** (Sorting topologically)
|
| 3118 |
+
*
|
| 3119 |
* ```ts
|
| 3120 |
* import { Graph } from "effect"
|
| 3121 |
*
|
|
|
|
| 3136 |
* // With initial nodes
|
| 3137 |
* const topo2 = Graph.topo(graph, { initials: [0] })
|
| 3138 |
*
|
| 3139 |
+
* // Check before sorting a cyclic graph
|
| 3140 |
* const cyclicGraph = Graph.directed<string, number>((mutable) => {
|
| 3141 |
* const a = Graph.addNode(mutable, "A")
|
| 3142 |
* const b = Graph.addNode(mutable, "B")
|
|
|
|
| 3144 |
* Graph.addEdge(mutable, b, a, 2) // Creates cycle
|
| 3145 |
* })
|
| 3146 |
*
|
| 3147 |
+
* if (!Graph.isAcyclic(cyclicGraph)) {
|
| 3148 |
+
* console.log("cyclic graph") // cyclic graph
|
|
|
|
|
|
|
| 3149 |
* }
|
| 3150 |
* ```
|
| 3151 |
*
|
|
|
|
| 3152 |
* @category iterators
|
| 3153 |
+
* @since 3.18.0
|
| 3154 |
*/
|
| 3155 |
export const topo = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 3156 |
+
if (graph.type === "undirected") {
|
| 3157 |
+
throw new GraphError({
|
| 3158 |
+
message: "Cannot perform topological sort on undirected graph"
|
| 3159 |
+
});
|
| 3160 |
+
}
|
| 3161 |
// Check if graph is acyclic first
|
| 3162 |
if (!isAcyclic(graph)) {
|
| 3163 |
throw new GraphError({
|
|
|
|
| 3175 |
[Symbol.iterator]: () => {
|
| 3176 |
const inDegree = new Map();
|
| 3177 |
const remaining = new Set();
|
| 3178 |
+
const initialSet = new Set(initials);
|
| 3179 |
const queue = [...initials];
|
| 3180 |
// Initialize in-degree counts
|
| 3181 |
for (const [nodeIndex] of graph.nodes) {
|
|
|
|
| 3187 |
const currentInDegree = inDegree.get(edgeData.target) || 0;
|
| 3188 |
inDegree.set(edgeData.target, currentInDegree + 1);
|
| 3189 |
}
|
| 3190 |
+
for (const nodeIndex of initials) {
|
| 3191 |
+
if (inDegree.get(nodeIndex) !== 0) {
|
| 3192 |
+
throw new GraphError({
|
| 3193 |
+
message: `Initial node ${nodeIndex} has incoming edges`
|
| 3194 |
+
});
|
| 3195 |
+
}
|
| 3196 |
+
}
|
| 3197 |
+
// Add remaining zero in-degree nodes after prioritized initials.
|
| 3198 |
+
for (const [nodeIndex, degree] of inDegree) {
|
| 3199 |
+
if (degree === 0 && !initialSet.has(nodeIndex)) {
|
| 3200 |
+
queue.push(nodeIndex);
|
| 3201 |
}
|
| 3202 |
}
|
| 3203 |
const nextMapped = () => {
|
|
|
|
| 3206 |
if (remaining.has(current)) {
|
| 3207 |
remaining.delete(current);
|
| 3208 |
// Process outgoing edges, reducing in-degree of targets
|
| 3209 |
+
const neighbors = getDirectedNeighbors(graph, current, "outgoing");
|
| 3210 |
for (const neighbor of neighbors) {
|
| 3211 |
if (remaining.has(neighbor)) {
|
| 3212 |
const currentInDegree = inDegree.get(neighbor) || 0;
|
|
|
|
| 3240 |
}));
|
| 3241 |
});
|
| 3242 |
/**
|
| 3243 |
+
* Creates a lazy depth-first postorder traversal iterator from the configured
|
| 3244 |
+
* start nodes.
|
| 3245 |
+
*
|
| 3246 |
+
* **Details**
|
| 3247 |
*
|
| 3248 |
+
* Nodes are emitted after their reachable descendants have been processed. If
|
| 3249 |
+
* no start nodes are supplied, the iterator is empty. The `direction` option
|
| 3250 |
+
* chooses whether to follow outgoing or incoming edges.
|
| 3251 |
+
*
|
| 3252 |
+
* **Example** (Traversing in postorder)
|
| 3253 |
*
|
|
|
|
| 3254 |
* ```ts
|
| 3255 |
* import { Graph } from "effect"
|
| 3256 |
*
|
|
|
|
| 3269 |
* }
|
| 3270 |
* ```
|
| 3271 |
*
|
|
|
|
| 3272 |
* @category iterators
|
| 3273 |
+
* @since 3.18.0
|
| 3274 |
*/
|
| 3275 |
export const dfsPostOrder = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 3276 |
const start = config.start ?? [];
|
|
|
|
| 3302 |
}
|
| 3303 |
if (!current.visitedChildren) {
|
| 3304 |
current.visitedChildren = true;
|
| 3305 |
+
const neighbors = getTraversalNeighbors(graph, current.node, direction);
|
| 3306 |
for (let i = neighbors.length - 1; i >= 0; i--) {
|
| 3307 |
const neighbor = neighbors[i];
|
| 3308 |
if (!discovered.has(neighbor) && !finished.has(neighbor)) {
|
|
|
|
| 3341 |
/**
|
| 3342 |
* Creates an iterator over all node indices in the graph.
|
| 3343 |
*
|
| 3344 |
+
* **Details**
|
| 3345 |
+
*
|
| 3346 |
* The iterator produces node indices in the order they were added to the graph.
|
| 3347 |
* This provides access to all nodes regardless of connectivity.
|
| 3348 |
*
|
| 3349 |
+
* **Example** (Iterating all nodes)
|
| 3350 |
+
*
|
| 3351 |
* ```ts
|
| 3352 |
* import { Graph } from "effect"
|
| 3353 |
*
|
|
|
|
| 3362 |
* console.log(indices) // [0, 1, 2]
|
| 3363 |
* ```
|
| 3364 |
*
|
|
|
|
| 3365 |
* @category iterators
|
| 3366 |
+
* @since 3.18.0
|
| 3367 |
*/
|
| 3368 |
export const nodes = graph => new Walker(f => ({
|
| 3369 |
[Symbol.iterator]() {
|
|
|
|
| 3390 |
/**
|
| 3391 |
* Creates an iterator over all edge indices in the graph.
|
| 3392 |
*
|
| 3393 |
+
* **Details**
|
| 3394 |
+
*
|
| 3395 |
* The iterator produces edge indices in the order they were added to the graph.
|
| 3396 |
* This provides access to all edges regardless of connectivity.
|
| 3397 |
*
|
| 3398 |
+
* **Example** (Iterating all edges)
|
| 3399 |
+
*
|
| 3400 |
* ```ts
|
| 3401 |
* import { Graph } from "effect"
|
| 3402 |
*
|
|
|
|
| 3412 |
* console.log(indices) // [0, 1]
|
| 3413 |
* ```
|
| 3414 |
*
|
|
|
|
| 3415 |
* @category iterators
|
| 3416 |
+
* @since 3.18.0
|
| 3417 |
*/
|
| 3418 |
export const edges = graph => new Walker(f => ({
|
| 3419 |
[Symbol.iterator]() {
|
|
|
|
| 3438 |
}
|
| 3439 |
}));
|
| 3440 |
/**
|
| 3441 |
+
* Creates an iterator over external nodes (nodes without edges in the specified direction).
|
| 3442 |
+
*
|
| 3443 |
+
* **Details**
|
| 3444 |
*
|
| 3445 |
+
* External nodes have no outgoing edges (`direction: "outgoing"`) or no
|
| 3446 |
+
* incoming edges (`direction: "incoming"`). These are useful for finding
|
| 3447 |
* sources, sinks, or isolated nodes.
|
| 3448 |
*
|
| 3449 |
+
* **Example** (Iterating external nodes)
|
| 3450 |
+
*
|
| 3451 |
* ```ts
|
| 3452 |
* import { Graph } from "effect"
|
| 3453 |
*
|
|
|
|
| 3474 |
* console.log(sources) // [0, 3]
|
| 3475 |
* ```
|
| 3476 |
*
|
|
|
|
| 3477 |
* @category iterators
|
| 3478 |
+
* @since 3.18.0
|
| 3479 |
*/
|
| 3480 |
export const externals = /*#__PURE__*/dual(args => isGraph(args[0]), (graph, config = {}) => {
|
| 3481 |
const direction = config.direction ?? "outgoing";
|
.opencode/node_modules/effect/dist/Graph.js.map
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.opencode/node_modules/effect/dist/HKT.d.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* The HKT system in Effect uses TypeLambdas to encode type-level functions that
|
| 10 |
-
* can represent complex type relationships with multiple type parameters, including
|
| 11 |
-
* contravariant, covariant, and invariant positions.
|
| 12 |
-
*
|
| 13 |
-
* @example
|
| 14 |
-
* ```ts
|
| 15 |
-
* import type { HKT } from "effect"
|
| 16 |
-
*
|
| 17 |
-
* // Define a TypeLambda for Array
|
| 18 |
-
* interface ArrayTypeLambda extends HKT.TypeLambda {
|
| 19 |
-
* readonly type: Array<this["Target"]>
|
| 20 |
-
* }
|
| 21 |
-
*
|
| 22 |
-
* // Use Kind to get the concrete type
|
| 23 |
-
* type MyArray = HKT.Kind<ArrayTypeLambda, never, never, never, string>
|
| 24 |
-
* // MyArray is Array<string>
|
| 25 |
-
*
|
| 26 |
-
* // Define a TypeClass that works with any HKT
|
| 27 |
-
* interface Functor<F extends HKT.TypeLambda> extends HKT.TypeClass<F> {
|
| 28 |
-
* map<A, B>(
|
| 29 |
-
* fa: HKT.Kind<F, never, never, never, A>,
|
| 30 |
-
* f: (a: A) => B
|
| 31 |
-
* ): HKT.Kind<F, never, never, never, B>
|
| 32 |
-
* }
|
| 33 |
-
* ```
|
| 34 |
*
|
| 35 |
* @since 2.0.0
|
| 36 |
*/
|
| 37 |
import type * as Types from "./Types.ts";
|
| 38 |
/**
|
| 39 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
*
|
| 41 |
-
*
|
| 42 |
-
* with their corresponding TypeLambda. It provides a way to link runtime
|
| 43 |
-
* type class instances with their compile-time type information.
|
| 44 |
*
|
| 45 |
-
* @example
|
| 46 |
* ```ts
|
| 47 |
* import type { HKT } from "effect"
|
| 48 |
*
|
| 49 |
-
* interface
|
| 50 |
-
*
|
| 51 |
* }
|
| 52 |
*
|
| 53 |
-
*
|
| 54 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
* ```
|
| 56 |
*
|
| 57 |
-
* @since 2.0.0
|
| 58 |
* @category symbols
|
|
|
|
| 59 |
*/
|
| 60 |
export declare const URI: unique symbol;
|
| 61 |
/**
|
| 62 |
* Base interface for type classes that work with Higher-Kinded Types.
|
| 63 |
*
|
| 64 |
-
*
|
| 65 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
* works across different container types like Array, Option, Effect, etc.
|
| 67 |
*
|
| 68 |
-
*
|
|
|
|
| 69 |
* ```ts
|
| 70 |
* import type { HKT } from "effect"
|
| 71 |
*
|
|
@@ -86,8 +86,8 @@ export declare const URI: unique symbol;
|
|
| 86 |
* }
|
| 87 |
* ```
|
| 88 |
*
|
| 89 |
-
* @since 2.0.0
|
| 90 |
* @category models
|
|
|
|
| 91 |
*/
|
| 92 |
export interface TypeClass<F extends TypeLambda> {
|
| 93 |
readonly [URI]?: F;
|
|
@@ -95,17 +95,20 @@ export interface TypeClass<F extends TypeLambda> {
|
|
| 95 |
/**
|
| 96 |
* Base interface for defining Higher-Kinded Type parameters.
|
| 97 |
*
|
| 98 |
-
*
|
| 99 |
-
*
|
| 100 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
*
|
| 102 |
-
*
|
| 103 |
-
* - `In`: Contravariant input parameter
|
| 104 |
-
* - `Out2`: Covariant output parameter (often used for errors)
|
| 105 |
-
* - `Out1`: Covariant output parameter (often used for context/environment)
|
| 106 |
-
* - `Target`: Invariant target parameter (the main type)
|
| 107 |
*
|
| 108 |
-
* @example
|
| 109 |
* ```ts
|
| 110 |
* import type { Effect, HKT } from "effect"
|
| 111 |
*
|
|
@@ -125,8 +128,8 @@ export interface TypeClass<F extends TypeLambda> {
|
|
| 125 |
* }
|
| 126 |
* ```
|
| 127 |
*
|
| 128 |
-
* @since 2.0.0
|
| 129 |
* @category models
|
|
|
|
| 130 |
*/
|
| 131 |
export interface TypeLambda {
|
| 132 |
readonly In: unknown;
|
|
@@ -135,17 +138,22 @@ export interface TypeLambda {
|
|
| 135 |
readonly Target: unknown;
|
| 136 |
}
|
| 137 |
/**
|
| 138 |
-
* Applies type parameters to a TypeLambda to get the concrete type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
*
|
| 140 |
-
* This type-level function takes a TypeLambda and four type parameters,
|
| 141 |
-
*
|
| 142 |
-
*
|
| 143 |
-
*
|
|
|
|
| 144 |
*
|
| 145 |
-
*
|
| 146 |
-
* abstract type constructors into concrete types by applying arguments.
|
| 147 |
*
|
| 148 |
-
* @example
|
| 149 |
* ```ts
|
| 150 |
* import type { Effect, HKT, Option } from "effect"
|
| 151 |
*
|
|
@@ -181,8 +189,8 @@ export interface TypeLambda {
|
|
| 181 |
* >
|
| 182 |
* ```
|
| 183 |
*
|
|
|
|
| 184 |
* @since 2.0.0
|
| 185 |
-
* @category type utils
|
| 186 |
*/
|
| 187 |
export type Kind<F extends TypeLambda, In, Out2, Out1, Target> = F extends {
|
| 188 |
readonly type: unknown;
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Provides type-level helpers for generic code over container-like types.
|
| 3 |
*
|
| 4 |
+
* TypeScript cannot directly abstract over shapes such as `Option<A>`,
|
| 5 |
+
* `ReadonlyArray<A>`, or `Effect<A, E, R>`. This module represents those shapes
|
| 6 |
+
* with `TypeLambda` and applies concrete type arguments with `Kind`. It is
|
| 7 |
+
* mostly useful when defining generic helpers or type classes that should work
|
| 8 |
+
* across several data types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
| 12 |
import type * as Types from "./Types.ts";
|
| 13 |
/**
|
| 14 |
+
* Defines the unique symbol used to associate `TypeClass` implementations with their `TypeLambda`.
|
| 15 |
+
*
|
| 16 |
+
* **When to use**
|
| 17 |
+
*
|
| 18 |
+
* Use when you need to define a custom type class that exposes the `TypeLambda`
|
| 19 |
+
* it operates on.
|
| 20 |
+
*
|
| 21 |
+
* **Details**
|
| 22 |
+
*
|
| 23 |
+
* This symbol links a type class shape with its compile-time type lambda. It is
|
| 24 |
+
* intended for type-class definitions and has no runtime behavior.
|
| 25 |
*
|
| 26 |
+
* **Example** (Linking a type class to a type lambda)
|
|
|
|
|
|
|
| 27 |
*
|
|
|
|
| 28 |
* ```ts
|
| 29 |
* import type { HKT } from "effect"
|
| 30 |
*
|
| 31 |
+
* interface IdentityTypeLambda extends HKT.TypeLambda {
|
| 32 |
+
* readonly type: this["Target"]
|
| 33 |
* }
|
| 34 |
*
|
| 35 |
+
* interface IdentityTypeClass extends HKT.TypeClass<IdentityTypeLambda> {
|
| 36 |
+
* readonly [HKT.URI]?: IdentityTypeLambda
|
| 37 |
+
* readonly of: <A>(value: A) => HKT.Kind<IdentityTypeLambda, never, never, never, A>
|
| 38 |
+
* }
|
| 39 |
+
*
|
| 40 |
+
* const identity: IdentityTypeClass = {
|
| 41 |
+
* of: (value) => value
|
| 42 |
+
* }
|
| 43 |
+
*
|
| 44 |
+
* type LinkedTypeLambda = typeof identity[typeof HKT.URI]
|
| 45 |
+
*
|
| 46 |
+
* const value: HKT.Kind<NonNullable<LinkedTypeLambda>, never, never, never, string> = identity.of("ok")
|
| 47 |
+
* console.log(value) // "ok"
|
| 48 |
* ```
|
| 49 |
*
|
|
|
|
| 50 |
* @category symbols
|
| 51 |
+
* @since 2.0.0
|
| 52 |
*/
|
| 53 |
export declare const URI: unique symbol;
|
| 54 |
/**
|
| 55 |
* Base interface for type classes that work with Higher-Kinded Types.
|
| 56 |
*
|
| 57 |
+
* **When to use**
|
| 58 |
+
*
|
| 59 |
+
* Use to define type class interfaces parameterized by a `TypeLambda`.
|
| 60 |
+
*
|
| 61 |
+
* **Details**
|
| 62 |
+
*
|
| 63 |
+
* A `TypeClass` defines operations that can be performed on any type constructor
|
| 64 |
+
* that matches the given `TypeLambda`. This enables writing generic code that
|
| 65 |
* works across different container types like Array, Option, Effect, etc.
|
| 66 |
*
|
| 67 |
+
* **Example** (Defining higher-kinded type classes)
|
| 68 |
+
*
|
| 69 |
* ```ts
|
| 70 |
* import type { HKT } from "effect"
|
| 71 |
*
|
|
|
|
| 86 |
* }
|
| 87 |
* ```
|
| 88 |
*
|
|
|
|
| 89 |
* @category models
|
| 90 |
+
* @since 2.0.0
|
| 91 |
*/
|
| 92 |
export interface TypeClass<F extends TypeLambda> {
|
| 93 |
readonly [URI]?: F;
|
|
|
|
| 95 |
/**
|
| 96 |
* Base interface for defining Higher-Kinded Type parameters.
|
| 97 |
*
|
| 98 |
+
* **When to use**
|
| 99 |
+
*
|
| 100 |
+
* Use to encode a type constructor for higher-kinded generic programming.
|
| 101 |
+
*
|
| 102 |
+
* **Details**
|
| 103 |
+
*
|
| 104 |
+
* A `TypeLambda` encodes the "shape" of a type constructor, specifying how many
|
| 105 |
+
* type parameters it takes and their variance (contravariant, covariant, or
|
| 106 |
+
* invariant). The four parameters are `In` for contravariant input, `Out2` for
|
| 107 |
+
* covariant output often used for errors, `Out1` for covariant output often used
|
| 108 |
+
* for context or environment, and `Target` for the invariant main type.
|
| 109 |
*
|
| 110 |
+
* **Example** (Defining type lambdas)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
*
|
|
|
|
| 112 |
* ```ts
|
| 113 |
* import type { Effect, HKT } from "effect"
|
| 114 |
*
|
|
|
|
| 128 |
* }
|
| 129 |
* ```
|
| 130 |
*
|
|
|
|
| 131 |
* @category models
|
| 132 |
+
* @since 2.0.0
|
| 133 |
*/
|
| 134 |
export interface TypeLambda {
|
| 135 |
readonly In: unknown;
|
|
|
|
| 138 |
readonly Target: unknown;
|
| 139 |
}
|
| 140 |
/**
|
| 141 |
+
* Applies type parameters to a `TypeLambda` to get the concrete type.
|
| 142 |
+
*
|
| 143 |
+
* **When to use**
|
| 144 |
+
*
|
| 145 |
+
* Use to apply a `TypeLambda` to type parameters and obtain its concrete type.
|
| 146 |
+
*
|
| 147 |
+
* **Details**
|
| 148 |
*
|
| 149 |
+
* This type-level function takes a `TypeLambda` and four type parameters, then
|
| 150 |
+
* "applies" them to get the actual type. It handles variance correctly, ensuring
|
| 151 |
+
* contravariant parameters are used as inputs and covariant parameters as
|
| 152 |
+
* outputs. This is the core mechanism that allows HKT to transform abstract type
|
| 153 |
+
* constructors into concrete types by applying arguments.
|
| 154 |
*
|
| 155 |
+
* **Example** (Applying type lambdas)
|
|
|
|
| 156 |
*
|
|
|
|
| 157 |
* ```ts
|
| 158 |
* import type { Effect, HKT, Option } from "effect"
|
| 159 |
*
|
|
|
|
| 189 |
* >
|
| 190 |
* ```
|
| 191 |
*
|
| 192 |
+
* @category utility types
|
| 193 |
* @since 2.0.0
|
|
|
|
| 194 |
*/
|
| 195 |
export type Kind<F extends TypeLambda, In, Out2, Out1, Target> = F extends {
|
| 196 |
readonly type: unknown;
|
.opencode/node_modules/effect/dist/HKT.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HKT.d.ts","sourceRoot":"","sources":["../src/HKT.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"HKT.d.ts","sourceRoot":"","sources":["../src/HKT.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,OAAO,MAAM,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,UAAU;IAC7C,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC,SAAS;IACzE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB,GAAG,CAAC,CAAC,GAAG;IACL,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAA;IACf,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB,CAAC,CAAC,MAAM,CAAC,GACR;IACA,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAA;IACb,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;IACpC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACpC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACpC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;CACzC,CAAA"}
|
.opencode/node_modules/effect/dist/Hash.d.ts
CHANGED
|
@@ -1,16 +1,33 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
* @since 2.0.0
|
| 5 |
*/
|
| 6 |
export declare const symbol = "~effect/interfaces/Hash";
|
| 7 |
/**
|
| 8 |
* A type that represents an object that can be hashed.
|
| 9 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
* Objects implementing this interface provide a method to compute their hash value,
|
| 11 |
* which is used for efficient comparison and storage operations.
|
| 12 |
*
|
| 13 |
-
*
|
|
|
|
| 14 |
* ```ts
|
| 15 |
* import { Hash } from "effect"
|
| 16 |
*
|
|
@@ -35,21 +52,27 @@ export interface Hash {
|
|
| 35 |
/**
|
| 36 |
* Computes a hash value for any given value.
|
| 37 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
* This function can hash primitives (numbers, strings, booleans, etc.) as well as
|
| 39 |
* objects, arrays, and other complex data structures. It automatically handles
|
| 40 |
* different types and provides a consistent hash value for equivalent inputs.
|
| 41 |
*
|
| 42 |
-
* **
|
| 43 |
-
* immutable after their first hash computation. Hash results are cached, so mutating
|
| 44 |
-
* an object after hashing will lead to stale cached values and broken hash-based
|
| 45 |
-
* operations. For mutable objects, use referential equality by implementing custom
|
| 46 |
-
* `Hash` interface that hashes the object reference, not its content.
|
| 47 |
*
|
| 48 |
-
*
|
| 49 |
-
*
|
| 50 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
*
|
| 52 |
-
* @example
|
| 53 |
* ```ts
|
| 54 |
* import { Hash } from "effect"
|
| 55 |
*
|
|
@@ -61,7 +84,7 @@ export interface Hash {
|
|
| 61 |
* // Hash objects and arrays
|
| 62 |
* console.log(Hash.hash({ name: "John", age: 30 }))
|
| 63 |
* console.log(Hash.hash([1, 2, 3]))
|
| 64 |
-
* console.log(Hash.hash(
|
| 65 |
* ```
|
| 66 |
*
|
| 67 |
* @category hashing
|
|
@@ -71,11 +94,18 @@ export declare const hash: <A>(self: A) => number;
|
|
| 71 |
/**
|
| 72 |
* Generates a random hash value for an object and caches it.
|
| 73 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
* This function creates a random hash value for objects that don't have their own
|
| 75 |
* hash implementation. The hash value is cached using a WeakMap, so the same object
|
| 76 |
* will always return the same hash value during its lifetime.
|
| 77 |
*
|
| 78 |
-
*
|
|
|
|
| 79 |
* ```ts
|
| 80 |
* import { Hash } from "effect"
|
| 81 |
*
|
|
@@ -96,16 +126,22 @@ export declare const random: <A extends object>(self: A) => number;
|
|
| 96 |
/**
|
| 97 |
* Combines two hash values into a single hash value.
|
| 98 |
*
|
| 99 |
-
*
|
| 100 |
-
*
|
| 101 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
*
|
| 103 |
-
* @example
|
| 104 |
* ```ts
|
| 105 |
-
* import { Hash } from "effect"
|
| 106 |
*
|
| 107 |
* // Can also be used with pipe
|
| 108 |
-
* import { pipe } from "effect"
|
| 109 |
*
|
| 110 |
* const hash1 = Hash.hash("hello")
|
| 111 |
* const hash2 = Hash.hash("world")
|
|
@@ -116,6 +152,9 @@ export declare const random: <A extends object>(self: A) => number;
|
|
| 116 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 117 |
* ```
|
| 118 |
*
|
|
|
|
|
|
|
|
|
|
| 119 |
* @category hashing
|
| 120 |
* @since 2.0.0
|
| 121 |
*/
|
|
@@ -123,16 +162,22 @@ export declare const combine: {
|
|
| 123 |
/**
|
| 124 |
* Combines two hash values into a single hash value.
|
| 125 |
*
|
| 126 |
-
*
|
| 127 |
-
*
|
| 128 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
*
|
| 130 |
-
* @example
|
| 131 |
* ```ts
|
| 132 |
-
* import { Hash } from "effect"
|
| 133 |
*
|
| 134 |
* // Can also be used with pipe
|
| 135 |
-
* import { pipe } from "effect"
|
| 136 |
*
|
| 137 |
* const hash1 = Hash.hash("hello")
|
| 138 |
* const hash2 = Hash.hash("world")
|
|
@@ -143,6 +188,9 @@ export declare const combine: {
|
|
| 143 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 144 |
* ```
|
| 145 |
*
|
|
|
|
|
|
|
|
|
|
| 146 |
* @category hashing
|
| 147 |
* @since 2.0.0
|
| 148 |
*/
|
|
@@ -150,16 +198,22 @@ export declare const combine: {
|
|
| 150 |
/**
|
| 151 |
* Combines two hash values into a single hash value.
|
| 152 |
*
|
| 153 |
-
*
|
| 154 |
-
*
|
| 155 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
*
|
| 157 |
-
* @example
|
| 158 |
* ```ts
|
| 159 |
-
* import { Hash } from "effect"
|
| 160 |
*
|
| 161 |
* // Can also be used with pipe
|
| 162 |
-
* import { pipe } from "effect"
|
| 163 |
*
|
| 164 |
* const hash1 = Hash.hash("hello")
|
| 165 |
* const hash2 = Hash.hash("world")
|
|
@@ -170,18 +224,28 @@ export declare const combine: {
|
|
| 170 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 171 |
* ```
|
| 172 |
*
|
|
|
|
|
|
|
|
|
|
| 173 |
* @category hashing
|
| 174 |
* @since 2.0.0
|
| 175 |
*/
|
| 176 |
(self: number, b: number): number;
|
| 177 |
};
|
| 178 |
/**
|
| 179 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
*
|
| 181 |
* This function takes a hash value and applies bitwise operations to improve
|
| 182 |
* the distribution of hash values, reducing the likelihood of collisions.
|
| 183 |
*
|
| 184 |
-
*
|
|
|
|
| 185 |
* ```ts
|
| 186 |
* import { Hash } from "effect"
|
| 187 |
*
|
|
@@ -198,12 +262,19 @@ export declare const combine: {
|
|
| 198 |
*/
|
| 199 |
export declare const optimize: (n: number) => number;
|
| 200 |
/**
|
| 201 |
-
* Checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
*
|
| 203 |
* This function determines whether a given value has the Hash symbol property,
|
| 204 |
* indicating that it can provide its own hash value implementation.
|
| 205 |
*
|
| 206 |
-
*
|
|
|
|
| 207 |
* ```ts
|
| 208 |
* import { Hash } from "effect"
|
| 209 |
*
|
|
@@ -226,11 +297,18 @@ export declare const isHash: (u: unknown) => u is Hash;
|
|
| 226 |
/**
|
| 227 |
* Computes a hash value for a number.
|
| 228 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
* This function creates a hash value for numeric inputs, handling special cases
|
| 230 |
* like NaN, Infinity, and -Infinity with distinct hash values. It uses bitwise operations to ensure good distribution
|
| 231 |
* of hash values across different numeric inputs.
|
| 232 |
*
|
| 233 |
-
*
|
|
|
|
| 234 |
* ```ts
|
| 235 |
* import { Hash } from "effect"
|
| 236 |
*
|
|
@@ -250,11 +328,19 @@ export declare const number: (n: number) => number;
|
|
| 250 |
/**
|
| 251 |
* Computes a hash value for a string using the djb2 algorithm.
|
| 252 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
* This function implements a variation of the djb2 hash algorithm, which is
|
| 254 |
* known for its good distribution properties and speed. It processes each
|
| 255 |
* character of the string to produce a consistent hash value.
|
| 256 |
*
|
| 257 |
-
*
|
|
|
|
| 258 |
* ```ts
|
| 259 |
* import { Hash } from "effect"
|
| 260 |
*
|
|
@@ -273,11 +359,18 @@ export declare const string: (str: string) => number;
|
|
| 273 |
/**
|
| 274 |
* Computes a hash value for an object using only the specified keys.
|
| 275 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
* This function allows you to hash an object by considering only specific keys,
|
| 277 |
* which is useful when you want to create a hash based on a subset of an object's
|
| 278 |
* properties.
|
| 279 |
*
|
| 280 |
-
*
|
|
|
|
| 281 |
* ```ts
|
| 282 |
* import { Hash } from "effect"
|
| 283 |
*
|
|
@@ -301,13 +394,19 @@ export declare const string: (str: string) => number;
|
|
| 301 |
*/
|
| 302 |
export declare const structureKeys: (o: object, keys: Iterable<PropertyKey>) => number;
|
| 303 |
/**
|
| 304 |
-
* Computes a hash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 305 |
*
|
| 306 |
-
*
|
| 307 |
-
* It's a convenient way to hash an entire object structure when you want to consider
|
| 308 |
-
* all its properties.
|
| 309 |
*
|
| 310 |
-
* @example
|
| 311 |
* ```ts
|
| 312 |
* import { Hash } from "effect"
|
| 313 |
*
|
|
@@ -328,13 +427,24 @@ export declare const structureKeys: (o: object, keys: Iterable<PropertyKey>) =>
|
|
| 328 |
*/
|
| 329 |
export declare const structure: <A extends object>(o: A) => number;
|
| 330 |
/**
|
| 331 |
-
* Computes a hash value for an
|
| 332 |
*
|
| 333 |
-
*
|
| 334 |
-
*
|
| 335 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
*
|
| 337 |
-
* @example
|
| 338 |
* ```ts
|
| 339 |
* import { Hash } from "effect"
|
| 340 |
*
|
|
@@ -344,13 +454,14 @@ export declare const structure: <A extends object>(o: A) => number;
|
|
| 344 |
*
|
| 345 |
* console.log(Hash.array(arr1)) // hash of [1, 2, 3]
|
| 346 |
* console.log(Hash.array(arr2)) // same hash as arr1
|
| 347 |
-
* console.log(Hash.array(arr3)) //
|
| 348 |
*
|
| 349 |
-
* // Arrays with same elements in same order produce same hash
|
| 350 |
* console.log(Hash.array(arr1) === Hash.array(arr2)) // true
|
| 351 |
-
* console.log(Hash.array(arr1) === Hash.array(arr3)) //
|
| 352 |
* ```
|
| 353 |
*
|
|
|
|
|
|
|
| 354 |
* @category hashing
|
| 355 |
* @since 2.0.0
|
| 356 |
*/
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Defines the unique identifier used to identify objects that implement the Hash interface.
|
| 3 |
*
|
| 4 |
+
* **When to use**
|
| 5 |
+
*
|
| 6 |
+
* Use as the computed property key for the method that supplies a custom hash
|
| 7 |
+
* value on a `Hash` implementor.
|
| 8 |
+
*
|
| 9 |
+
* @see {@link Hash} for the interface implemented with this symbol
|
| 10 |
+
* @see {@link isHash} for checking whether a value implements `Hash`
|
| 11 |
+
* @see {@link hash} for computing hash values
|
| 12 |
+
*
|
| 13 |
+
* @category symbols
|
| 14 |
* @since 2.0.0
|
| 15 |
*/
|
| 16 |
export declare const symbol = "~effect/interfaces/Hash";
|
| 17 |
/**
|
| 18 |
* A type that represents an object that can be hashed.
|
| 19 |
*
|
| 20 |
+
* **When to use**
|
| 21 |
+
*
|
| 22 |
+
* Use to let a custom type provide its own stable hash value.
|
| 23 |
+
*
|
| 24 |
+
* **Details**
|
| 25 |
+
*
|
| 26 |
* Objects implementing this interface provide a method to compute their hash value,
|
| 27 |
* which is used for efficient comparison and storage operations.
|
| 28 |
*
|
| 29 |
+
* **Example** (Implementing Hash)
|
| 30 |
+
*
|
| 31 |
* ```ts
|
| 32 |
* import { Hash } from "effect"
|
| 33 |
*
|
|
|
|
| 52 |
/**
|
| 53 |
* Computes a hash value for any given value.
|
| 54 |
*
|
| 55 |
+
* **When to use**
|
| 56 |
+
*
|
| 57 |
+
* Use to compute an Effect hash for primitives, collections, and hashable
|
| 58 |
+
* objects.
|
| 59 |
+
*
|
| 60 |
+
* **Details**
|
| 61 |
+
*
|
| 62 |
* This function can hash primitives (numbers, strings, booleans, etc.) as well as
|
| 63 |
* objects, arrays, and other complex data structures. It automatically handles
|
| 64 |
* different types and provides a consistent hash value for equivalent inputs.
|
| 65 |
*
|
| 66 |
+
* **Gotchas**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
*
|
| 68 |
+
* Objects being hashed must be treated as immutable after their first hash
|
| 69 |
+
* computation. Hash results are cached, so mutating an object after hashing will
|
| 70 |
+
* lead to stale cached values and broken hash-based operations. For mutable
|
| 71 |
+
* objects, implement a custom `Hash` interface that hashes the object reference
|
| 72 |
+
* rather than its content.
|
| 73 |
+
*
|
| 74 |
+
* **Example** (Hashing different values)
|
| 75 |
*
|
|
|
|
| 76 |
* ```ts
|
| 77 |
* import { Hash } from "effect"
|
| 78 |
*
|
|
|
|
| 84 |
* // Hash objects and arrays
|
| 85 |
* console.log(Hash.hash({ name: "John", age: 30 }))
|
| 86 |
* console.log(Hash.hash([1, 2, 3]))
|
| 87 |
+
* console.log(Hash.hash({ id: "user-1", roles: ["admin", "editor"] }))
|
| 88 |
* ```
|
| 89 |
*
|
| 90 |
* @category hashing
|
|
|
|
| 94 |
/**
|
| 95 |
* Generates a random hash value for an object and caches it.
|
| 96 |
*
|
| 97 |
+
* **When to use**
|
| 98 |
+
*
|
| 99 |
+
* Use to hash an object by reference identity instead of structural content.
|
| 100 |
+
*
|
| 101 |
+
* **Details**
|
| 102 |
+
*
|
| 103 |
* This function creates a random hash value for objects that don't have their own
|
| 104 |
* hash implementation. The hash value is cached using a WeakMap, so the same object
|
| 105 |
* will always return the same hash value during its lifetime.
|
| 106 |
*
|
| 107 |
+
* **Example** (Hashing objects by reference)
|
| 108 |
+
*
|
| 109 |
* ```ts
|
| 110 |
* import { Hash } from "effect"
|
| 111 |
*
|
|
|
|
| 126 |
/**
|
| 127 |
* Combines two hash values into a single hash value.
|
| 128 |
*
|
| 129 |
+
* **When to use**
|
| 130 |
+
*
|
| 131 |
+
* Use to build a hash for a composite value by folding together hash values for
|
| 132 |
+
* its parts.
|
| 133 |
+
*
|
| 134 |
+
* **Details**
|
| 135 |
+
*
|
| 136 |
+
* Supports both direct and pipeable usage. The implementation combines two
|
| 137 |
+
* hash values with `(self * 53) ^ b`.
|
| 138 |
+
*
|
| 139 |
+
* **Example** (Combining hash values)
|
| 140 |
*
|
|
|
|
| 141 |
* ```ts
|
| 142 |
+
* import { Hash, pipe } from "effect"
|
| 143 |
*
|
| 144 |
* // Can also be used with pipe
|
|
|
|
| 145 |
*
|
| 146 |
* const hash1 = Hash.hash("hello")
|
| 147 |
* const hash2 = Hash.hash("world")
|
|
|
|
| 152 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 153 |
* ```
|
| 154 |
*
|
| 155 |
+
* @see {@link hash} for computing hash values from arbitrary inputs
|
| 156 |
+
* @see {@link structureKeys} for hashing selected object fields without manual combination
|
| 157 |
+
*
|
| 158 |
* @category hashing
|
| 159 |
* @since 2.0.0
|
| 160 |
*/
|
|
|
|
| 162 |
/**
|
| 163 |
* Combines two hash values into a single hash value.
|
| 164 |
*
|
| 165 |
+
* **When to use**
|
| 166 |
+
*
|
| 167 |
+
* Use to build a hash for a composite value by folding together hash values for
|
| 168 |
+
* its parts.
|
| 169 |
+
*
|
| 170 |
+
* **Details**
|
| 171 |
+
*
|
| 172 |
+
* Supports both direct and pipeable usage. The implementation combines two
|
| 173 |
+
* hash values with `(self * 53) ^ b`.
|
| 174 |
+
*
|
| 175 |
+
* **Example** (Combining hash values)
|
| 176 |
*
|
|
|
|
| 177 |
* ```ts
|
| 178 |
+
* import { Hash, pipe } from "effect"
|
| 179 |
*
|
| 180 |
* // Can also be used with pipe
|
|
|
|
| 181 |
*
|
| 182 |
* const hash1 = Hash.hash("hello")
|
| 183 |
* const hash2 = Hash.hash("world")
|
|
|
|
| 188 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 189 |
* ```
|
| 190 |
*
|
| 191 |
+
* @see {@link hash} for computing hash values from arbitrary inputs
|
| 192 |
+
* @see {@link structureKeys} for hashing selected object fields without manual combination
|
| 193 |
+
*
|
| 194 |
* @category hashing
|
| 195 |
* @since 2.0.0
|
| 196 |
*/
|
|
|
|
| 198 |
/**
|
| 199 |
* Combines two hash values into a single hash value.
|
| 200 |
*
|
| 201 |
+
* **When to use**
|
| 202 |
+
*
|
| 203 |
+
* Use to build a hash for a composite value by folding together hash values for
|
| 204 |
+
* its parts.
|
| 205 |
+
*
|
| 206 |
+
* **Details**
|
| 207 |
+
*
|
| 208 |
+
* Supports both direct and pipeable usage. The implementation combines two
|
| 209 |
+
* hash values with `(self * 53) ^ b`.
|
| 210 |
+
*
|
| 211 |
+
* **Example** (Combining hash values)
|
| 212 |
*
|
|
|
|
| 213 |
* ```ts
|
| 214 |
+
* import { Hash, pipe } from "effect"
|
| 215 |
*
|
| 216 |
* // Can also be used with pipe
|
|
|
|
| 217 |
*
|
| 218 |
* const hash1 = Hash.hash("hello")
|
| 219 |
* const hash2 = Hash.hash("world")
|
|
|
|
| 224 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 225 |
* ```
|
| 226 |
*
|
| 227 |
+
* @see {@link hash} for computing hash values from arbitrary inputs
|
| 228 |
+
* @see {@link structureKeys} for hashing selected object fields without manual combination
|
| 229 |
+
*
|
| 230 |
* @category hashing
|
| 231 |
* @since 2.0.0
|
| 232 |
*/
|
| 233 |
(self: number, b: number): number;
|
| 234 |
};
|
| 235 |
/**
|
| 236 |
+
* Applies bit manipulation techniques to optimize a hash value.
|
| 237 |
+
*
|
| 238 |
+
* **When to use**
|
| 239 |
+
*
|
| 240 |
+
* Use to improve the bit distribution of a raw numeric hash value.
|
| 241 |
+
*
|
| 242 |
+
* **Details**
|
| 243 |
*
|
| 244 |
* This function takes a hash value and applies bitwise operations to improve
|
| 245 |
* the distribution of hash values, reducing the likelihood of collisions.
|
| 246 |
*
|
| 247 |
+
* **Example** (Optimizing a hash value)
|
| 248 |
+
*
|
| 249 |
* ```ts
|
| 250 |
* import { Hash } from "effect"
|
| 251 |
*
|
|
|
|
| 262 |
*/
|
| 263 |
export declare const optimize: (n: number) => number;
|
| 264 |
/**
|
| 265 |
+
* Checks whether a value implements the Hash interface.
|
| 266 |
+
*
|
| 267 |
+
* **When to use**
|
| 268 |
+
*
|
| 269 |
+
* Use to detect whether an unknown value provides a custom hash implementation.
|
| 270 |
+
*
|
| 271 |
+
* **Details**
|
| 272 |
*
|
| 273 |
* This function determines whether a given value has the Hash symbol property,
|
| 274 |
* indicating that it can provide its own hash value implementation.
|
| 275 |
*
|
| 276 |
+
* **Example** (Checking for Hash support)
|
| 277 |
+
*
|
| 278 |
* ```ts
|
| 279 |
* import { Hash } from "effect"
|
| 280 |
*
|
|
|
|
| 297 |
/**
|
| 298 |
* Computes a hash value for a number.
|
| 299 |
*
|
| 300 |
+
* **When to use**
|
| 301 |
+
*
|
| 302 |
+
* Use to hash a JavaScript number with Effect's numeric hash semantics.
|
| 303 |
+
*
|
| 304 |
+
* **Details**
|
| 305 |
+
*
|
| 306 |
* This function creates a hash value for numeric inputs, handling special cases
|
| 307 |
* like NaN, Infinity, and -Infinity with distinct hash values. It uses bitwise operations to ensure good distribution
|
| 308 |
* of hash values across different numeric inputs.
|
| 309 |
*
|
| 310 |
+
* **Example** (Hashing numbers)
|
| 311 |
+
*
|
| 312 |
* ```ts
|
| 313 |
* import { Hash } from "effect"
|
| 314 |
*
|
|
|
|
| 328 |
/**
|
| 329 |
* Computes a hash value for a string using the djb2 algorithm.
|
| 330 |
*
|
| 331 |
+
* **When to use**
|
| 332 |
+
*
|
| 333 |
+
* Use when you need a string field to contribute to a custom structural hash
|
| 334 |
+
* implementation.
|
| 335 |
+
*
|
| 336 |
+
* **Details**
|
| 337 |
+
*
|
| 338 |
* This function implements a variation of the djb2 hash algorithm, which is
|
| 339 |
* known for its good distribution properties and speed. It processes each
|
| 340 |
* character of the string to produce a consistent hash value.
|
| 341 |
*
|
| 342 |
+
* **Example** (Hashing strings)
|
| 343 |
+
*
|
| 344 |
* ```ts
|
| 345 |
* import { Hash } from "effect"
|
| 346 |
*
|
|
|
|
| 359 |
/**
|
| 360 |
* Computes a hash value for an object using only the specified keys.
|
| 361 |
*
|
| 362 |
+
* **When to use**
|
| 363 |
+
*
|
| 364 |
+
* Use to hash an object by a selected set of property keys.
|
| 365 |
+
*
|
| 366 |
+
* **Details**
|
| 367 |
+
*
|
| 368 |
* This function allows you to hash an object by considering only specific keys,
|
| 369 |
* which is useful when you want to create a hash based on a subset of an object's
|
| 370 |
* properties.
|
| 371 |
*
|
| 372 |
+
* **Example** (Hashing selected object keys)
|
| 373 |
+
*
|
| 374 |
* ```ts
|
| 375 |
* import { Hash } from "effect"
|
| 376 |
*
|
|
|
|
| 394 |
*/
|
| 395 |
export declare const structureKeys: (o: object, keys: Iterable<PropertyKey>) => number;
|
| 396 |
/**
|
| 397 |
+
* Computes a structural hash for an object using Effect's object key collection.
|
| 398 |
+
*
|
| 399 |
+
* **When to use**
|
| 400 |
+
*
|
| 401 |
+
* Use to hash an object from all structural keys collected by Effect.
|
| 402 |
+
*
|
| 403 |
+
* **Details**
|
| 404 |
+
*
|
| 405 |
+
* The hash is based on the object's structural keys and their values, including
|
| 406 |
+
* symbol keys and relevant prototype keys for non-plain objects.
|
| 407 |
*
|
| 408 |
+
* **Example** (Hashing object structures)
|
|
|
|
|
|
|
| 409 |
*
|
|
|
|
| 410 |
* ```ts
|
| 411 |
* import { Hash } from "effect"
|
| 412 |
*
|
|
|
|
| 427 |
*/
|
| 428 |
export declare const structure: <A extends object>(o: A) => number;
|
| 429 |
/**
|
| 430 |
+
* Computes a hash value for an iterable by hashing all of its elements.
|
| 431 |
*
|
| 432 |
+
* **When to use**
|
| 433 |
+
*
|
| 434 |
+
* Use to hash the values yielded by an iterable with Effect hash semantics.
|
| 435 |
+
*
|
| 436 |
+
* **Details**
|
| 437 |
+
*
|
| 438 |
+
* The implementation folds element hashes from the seed `6151` with XOR and
|
| 439 |
+
* then optimizes the final hash.
|
| 440 |
+
*
|
| 441 |
+
* **Gotchas**
|
| 442 |
+
*
|
| 443 |
+
* A hash is not an equality proof. Because this implementation uses XOR,
|
| 444 |
+
* reordered inputs can produce the same hash.
|
| 445 |
+
*
|
| 446 |
+
* **Example** (Hashing arrays)
|
| 447 |
*
|
|
|
|
| 448 |
* ```ts
|
| 449 |
* import { Hash } from "effect"
|
| 450 |
*
|
|
|
|
| 454 |
*
|
| 455 |
* console.log(Hash.array(arr1)) // hash of [1, 2, 3]
|
| 456 |
* console.log(Hash.array(arr2)) // same hash as arr1
|
| 457 |
+
* console.log(Hash.array(arr3)) // may match reordered inputs
|
| 458 |
*
|
|
|
|
| 459 |
* console.log(Hash.array(arr1) === Hash.array(arr2)) // true
|
| 460 |
+
* console.log(Hash.array(arr1) === Hash.array(arr3)) // true
|
| 461 |
* ```
|
| 462 |
*
|
| 463 |
+
* @see {@link hash} for the general-purpose hash dispatcher
|
| 464 |
+
*
|
| 465 |
* @category hashing
|
| 466 |
* @since 2.0.0
|
| 467 |
*/
|
.opencode/node_modules/effect/dist/Hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../src/Hash.ts"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../src/Hash.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,4BAA4B,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,IAAI;IACnB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,MAoDlC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,MAKnD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,OAAO,EAAE;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC8B,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAqD,CAAA;AAE1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,MAAM,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,IAA8B,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WAkB/B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,WAMjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,WAMnE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,GAAG,CAAC,WAA0C,CAAA;AAU1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAiC,CAAA"}
|
.opencode/node_modules/effect/dist/Hash.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*
|
|
|
|
|
|
|
| 7 |
*
|
| 8 |
* @since 2.0.0
|
| 9 |
*/
|
|
@@ -11,29 +13,45 @@ import { dual } from "./Function.js";
|
|
| 11 |
import { byReferenceInstances, getAllObjectKeys } from "./internal/equal.js";
|
| 12 |
import { hasProperty } from "./Predicate.js";
|
| 13 |
/**
|
| 14 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
* @since 2.0.0
|
| 17 |
*/
|
| 18 |
export const symbol = "~effect/interfaces/Hash";
|
| 19 |
/**
|
| 20 |
* Computes a hash value for any given value.
|
| 21 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
* This function can hash primitives (numbers, strings, booleans, etc.) as well as
|
| 23 |
* objects, arrays, and other complex data structures. It automatically handles
|
| 24 |
* different types and provides a consistent hash value for equivalent inputs.
|
| 25 |
*
|
| 26 |
-
* **
|
| 27 |
-
*
|
| 28 |
-
*
|
| 29 |
-
*
|
| 30 |
-
*
|
|
|
|
|
|
|
| 31 |
*
|
| 32 |
-
* **
|
| 33 |
-
* **ALLOWED**: Using immutable objects, or mutable objects with custom `Hash` interface
|
| 34 |
-
* that uses referential equality (hashes the object reference, not content)
|
| 35 |
*
|
| 36 |
-
* @example
|
| 37 |
* ```ts
|
| 38 |
* import { Hash } from "effect"
|
| 39 |
*
|
|
@@ -45,7 +63,7 @@ export const symbol = "~effect/interfaces/Hash";
|
|
| 45 |
* // Hash objects and arrays
|
| 46 |
* console.log(Hash.hash({ name: "John", age: 30 }))
|
| 47 |
* console.log(Hash.hash([1, 2, 3]))
|
| 48 |
-
* console.log(Hash.hash(
|
| 49 |
* ```
|
| 50 |
*
|
| 51 |
* @category hashing
|
|
@@ -106,11 +124,18 @@ export const hash = self => {
|
|
| 106 |
/**
|
| 107 |
* Generates a random hash value for an object and caches it.
|
| 108 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
* This function creates a random hash value for objects that don't have their own
|
| 110 |
* hash implementation. The hash value is cached using a WeakMap, so the same object
|
| 111 |
* will always return the same hash value during its lifetime.
|
| 112 |
*
|
| 113 |
-
*
|
|
|
|
| 114 |
* ```ts
|
| 115 |
* import { Hash } from "effect"
|
| 116 |
*
|
|
@@ -136,16 +161,22 @@ export const random = self => {
|
|
| 136 |
/**
|
| 137 |
* Combines two hash values into a single hash value.
|
| 138 |
*
|
| 139 |
-
*
|
| 140 |
-
*
|
| 141 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
*
|
| 143 |
-
* @example
|
| 144 |
* ```ts
|
| 145 |
-
* import { Hash } from "effect"
|
| 146 |
*
|
| 147 |
* // Can also be used with pipe
|
| 148 |
-
* import { pipe } from "effect"
|
| 149 |
*
|
| 150 |
* const hash1 = Hash.hash("hello")
|
| 151 |
* const hash2 = Hash.hash("world")
|
|
@@ -156,17 +187,27 @@ export const random = self => {
|
|
| 156 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 157 |
* ```
|
| 158 |
*
|
|
|
|
|
|
|
|
|
|
| 159 |
* @category hashing
|
| 160 |
* @since 2.0.0
|
| 161 |
*/
|
| 162 |
export const combine = /*#__PURE__*/dual(2, (self, b) => self * 53 ^ b);
|
| 163 |
/**
|
| 164 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
*
|
| 166 |
* This function takes a hash value and applies bitwise operations to improve
|
| 167 |
* the distribution of hash values, reducing the likelihood of collisions.
|
| 168 |
*
|
| 169 |
-
*
|
|
|
|
| 170 |
* ```ts
|
| 171 |
* import { Hash } from "effect"
|
| 172 |
*
|
|
@@ -183,12 +224,19 @@ export const combine = /*#__PURE__*/dual(2, (self, b) => self * 53 ^ b);
|
|
| 183 |
*/
|
| 184 |
export const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
|
| 185 |
/**
|
| 186 |
-
* Checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
*
|
| 188 |
* This function determines whether a given value has the Hash symbol property,
|
| 189 |
* indicating that it can provide its own hash value implementation.
|
| 190 |
*
|
| 191 |
-
*
|
|
|
|
| 192 |
* ```ts
|
| 193 |
* import { Hash } from "effect"
|
| 194 |
*
|
|
@@ -211,11 +259,18 @@ export const isHash = u => hasProperty(u, symbol);
|
|
| 211 |
/**
|
| 212 |
* Computes a hash value for a number.
|
| 213 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
* This function creates a hash value for numeric inputs, handling special cases
|
| 215 |
* like NaN, Infinity, and -Infinity with distinct hash values. It uses bitwise operations to ensure good distribution
|
| 216 |
* of hash values across different numeric inputs.
|
| 217 |
*
|
| 218 |
-
*
|
|
|
|
| 219 |
* ```ts
|
| 220 |
* import { Hash } from "effect"
|
| 221 |
*
|
|
@@ -253,11 +308,19 @@ export const number = n => {
|
|
| 253 |
/**
|
| 254 |
* Computes a hash value for a string using the djb2 algorithm.
|
| 255 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
* This function implements a variation of the djb2 hash algorithm, which is
|
| 257 |
* known for its good distribution properties and speed. It processes each
|
| 258 |
* character of the string to produce a consistent hash value.
|
| 259 |
*
|
| 260 |
-
*
|
|
|
|
| 261 |
* ```ts
|
| 262 |
* import { Hash } from "effect"
|
| 263 |
*
|
|
@@ -283,11 +346,18 @@ export const string = str => {
|
|
| 283 |
/**
|
| 284 |
* Computes a hash value for an object using only the specified keys.
|
| 285 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
* This function allows you to hash an object by considering only specific keys,
|
| 287 |
* which is useful when you want to create a hash based on a subset of an object's
|
| 288 |
* properties.
|
| 289 |
*
|
| 290 |
-
*
|
|
|
|
| 291 |
* ```ts
|
| 292 |
* import { Hash } from "effect"
|
| 293 |
*
|
|
@@ -317,13 +387,19 @@ export const structureKeys = (o, keys) => {
|
|
| 317 |
return optimize(h);
|
| 318 |
};
|
| 319 |
/**
|
| 320 |
-
* Computes a hash
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
*
|
| 322 |
-
*
|
| 323 |
-
*
|
| 324 |
-
*
|
|
|
|
|
|
|
|
|
|
| 325 |
*
|
| 326 |
-
* @example
|
| 327 |
* ```ts
|
| 328 |
* import { Hash } from "effect"
|
| 329 |
*
|
|
@@ -351,13 +427,24 @@ const iterableWith = (seed, f) => iter => {
|
|
| 351 |
return optimize(h);
|
| 352 |
};
|
| 353 |
/**
|
| 354 |
-
* Computes a hash value for an
|
|
|
|
|
|
|
| 355 |
*
|
| 356 |
-
*
|
| 357 |
-
*
|
| 358 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
*
|
| 360 |
-
* @example
|
| 361 |
* ```ts
|
| 362 |
* import { Hash } from "effect"
|
| 363 |
*
|
|
@@ -367,13 +454,14 @@ const iterableWith = (seed, f) => iter => {
|
|
| 367 |
*
|
| 368 |
* console.log(Hash.array(arr1)) // hash of [1, 2, 3]
|
| 369 |
* console.log(Hash.array(arr2)) // same hash as arr1
|
| 370 |
-
* console.log(Hash.array(arr3)) //
|
| 371 |
*
|
| 372 |
-
* // Arrays with same elements in same order produce same hash
|
| 373 |
* console.log(Hash.array(arr1) === Hash.array(arr2)) // true
|
| 374 |
-
* console.log(Hash.array(arr1) === Hash.array(arr3)) //
|
| 375 |
* ```
|
| 376 |
*
|
|
|
|
|
|
|
| 377 |
* @category hashing
|
| 378 |
* @since 2.0.0
|
| 379 |
*/
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Computes Effect hash values and defines the interface for objects that want
|
| 3 |
+
* to provide their own hash implementation. Hashes are small numeric
|
| 4 |
+
* fingerprints used by Effect data structures to bucket values quickly; they
|
| 5 |
+
* are not cryptographic digests and they are not proof that two values are
|
| 6 |
+
* equal. The module also includes helpers for primitive, structure, array, and
|
| 7 |
+
* reference-based hashes, plus functions for combining and optimizing numeric
|
| 8 |
+
* hash values.
|
| 9 |
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
|
|
|
| 13 |
import { byReferenceInstances, getAllObjectKeys } from "./internal/equal.js";
|
| 14 |
import { hasProperty } from "./Predicate.js";
|
| 15 |
/**
|
| 16 |
+
* Defines the unique identifier used to identify objects that implement the Hash interface.
|
| 17 |
+
*
|
| 18 |
+
* **When to use**
|
| 19 |
+
*
|
| 20 |
+
* Use as the computed property key for the method that supplies a custom hash
|
| 21 |
+
* value on a `Hash` implementor.
|
| 22 |
*
|
| 23 |
+
* @see {@link Hash} for the interface implemented with this symbol
|
| 24 |
+
* @see {@link isHash} for checking whether a value implements `Hash`
|
| 25 |
+
* @see {@link hash} for computing hash values
|
| 26 |
+
*
|
| 27 |
+
* @category symbols
|
| 28 |
* @since 2.0.0
|
| 29 |
*/
|
| 30 |
export const symbol = "~effect/interfaces/Hash";
|
| 31 |
/**
|
| 32 |
* Computes a hash value for any given value.
|
| 33 |
*
|
| 34 |
+
* **When to use**
|
| 35 |
+
*
|
| 36 |
+
* Use to compute an Effect hash for primitives, collections, and hashable
|
| 37 |
+
* objects.
|
| 38 |
+
*
|
| 39 |
+
* **Details**
|
| 40 |
+
*
|
| 41 |
* This function can hash primitives (numbers, strings, booleans, etc.) as well as
|
| 42 |
* objects, arrays, and other complex data structures. It automatically handles
|
| 43 |
* different types and provides a consistent hash value for equivalent inputs.
|
| 44 |
*
|
| 45 |
+
* **Gotchas**
|
| 46 |
+
*
|
| 47 |
+
* Objects being hashed must be treated as immutable after their first hash
|
| 48 |
+
* computation. Hash results are cached, so mutating an object after hashing will
|
| 49 |
+
* lead to stale cached values and broken hash-based operations. For mutable
|
| 50 |
+
* objects, implement a custom `Hash` interface that hashes the object reference
|
| 51 |
+
* rather than its content.
|
| 52 |
*
|
| 53 |
+
* **Example** (Hashing different values)
|
|
|
|
|
|
|
| 54 |
*
|
|
|
|
| 55 |
* ```ts
|
| 56 |
* import { Hash } from "effect"
|
| 57 |
*
|
|
|
|
| 63 |
* // Hash objects and arrays
|
| 64 |
* console.log(Hash.hash({ name: "John", age: 30 }))
|
| 65 |
* console.log(Hash.hash([1, 2, 3]))
|
| 66 |
+
* console.log(Hash.hash({ id: "user-1", roles: ["admin", "editor"] }))
|
| 67 |
* ```
|
| 68 |
*
|
| 69 |
* @category hashing
|
|
|
|
| 124 |
/**
|
| 125 |
* Generates a random hash value for an object and caches it.
|
| 126 |
*
|
| 127 |
+
* **When to use**
|
| 128 |
+
*
|
| 129 |
+
* Use to hash an object by reference identity instead of structural content.
|
| 130 |
+
*
|
| 131 |
+
* **Details**
|
| 132 |
+
*
|
| 133 |
* This function creates a random hash value for objects that don't have their own
|
| 134 |
* hash implementation. The hash value is cached using a WeakMap, so the same object
|
| 135 |
* will always return the same hash value during its lifetime.
|
| 136 |
*
|
| 137 |
+
* **Example** (Hashing objects by reference)
|
| 138 |
+
*
|
| 139 |
* ```ts
|
| 140 |
* import { Hash } from "effect"
|
| 141 |
*
|
|
|
|
| 161 |
/**
|
| 162 |
* Combines two hash values into a single hash value.
|
| 163 |
*
|
| 164 |
+
* **When to use**
|
| 165 |
+
*
|
| 166 |
+
* Use to build a hash for a composite value by folding together hash values for
|
| 167 |
+
* its parts.
|
| 168 |
+
*
|
| 169 |
+
* **Details**
|
| 170 |
+
*
|
| 171 |
+
* Supports both direct and pipeable usage. The implementation combines two
|
| 172 |
+
* hash values with `(self * 53) ^ b`.
|
| 173 |
+
*
|
| 174 |
+
* **Example** (Combining hash values)
|
| 175 |
*
|
|
|
|
| 176 |
* ```ts
|
| 177 |
+
* import { Hash, pipe } from "effect"
|
| 178 |
*
|
| 179 |
* // Can also be used with pipe
|
|
|
|
| 180 |
*
|
| 181 |
* const hash1 = Hash.hash("hello")
|
| 182 |
* const hash2 = Hash.hash("world")
|
|
|
|
| 187 |
* const result = pipe(hash1, Hash.combine(hash2))
|
| 188 |
* ```
|
| 189 |
*
|
| 190 |
+
* @see {@link hash} for computing hash values from arbitrary inputs
|
| 191 |
+
* @see {@link structureKeys} for hashing selected object fields without manual combination
|
| 192 |
+
*
|
| 193 |
* @category hashing
|
| 194 |
* @since 2.0.0
|
| 195 |
*/
|
| 196 |
export const combine = /*#__PURE__*/dual(2, (self, b) => self * 53 ^ b);
|
| 197 |
/**
|
| 198 |
+
* Applies bit manipulation techniques to optimize a hash value.
|
| 199 |
+
*
|
| 200 |
+
* **When to use**
|
| 201 |
+
*
|
| 202 |
+
* Use to improve the bit distribution of a raw numeric hash value.
|
| 203 |
+
*
|
| 204 |
+
* **Details**
|
| 205 |
*
|
| 206 |
* This function takes a hash value and applies bitwise operations to improve
|
| 207 |
* the distribution of hash values, reducing the likelihood of collisions.
|
| 208 |
*
|
| 209 |
+
* **Example** (Optimizing a hash value)
|
| 210 |
+
*
|
| 211 |
* ```ts
|
| 212 |
* import { Hash } from "effect"
|
| 213 |
*
|
|
|
|
| 224 |
*/
|
| 225 |
export const optimize = n => n & 0xbfffffff | n >>> 1 & 0x40000000;
|
| 226 |
/**
|
| 227 |
+
* Checks whether a value implements the Hash interface.
|
| 228 |
+
*
|
| 229 |
+
* **When to use**
|
| 230 |
+
*
|
| 231 |
+
* Use to detect whether an unknown value provides a custom hash implementation.
|
| 232 |
+
*
|
| 233 |
+
* **Details**
|
| 234 |
*
|
| 235 |
* This function determines whether a given value has the Hash symbol property,
|
| 236 |
* indicating that it can provide its own hash value implementation.
|
| 237 |
*
|
| 238 |
+
* **Example** (Checking for Hash support)
|
| 239 |
+
*
|
| 240 |
* ```ts
|
| 241 |
* import { Hash } from "effect"
|
| 242 |
*
|
|
|
|
| 259 |
/**
|
| 260 |
* Computes a hash value for a number.
|
| 261 |
*
|
| 262 |
+
* **When to use**
|
| 263 |
+
*
|
| 264 |
+
* Use to hash a JavaScript number with Effect's numeric hash semantics.
|
| 265 |
+
*
|
| 266 |
+
* **Details**
|
| 267 |
+
*
|
| 268 |
* This function creates a hash value for numeric inputs, handling special cases
|
| 269 |
* like NaN, Infinity, and -Infinity with distinct hash values. It uses bitwise operations to ensure good distribution
|
| 270 |
* of hash values across different numeric inputs.
|
| 271 |
*
|
| 272 |
+
* **Example** (Hashing numbers)
|
| 273 |
+
*
|
| 274 |
* ```ts
|
| 275 |
* import { Hash } from "effect"
|
| 276 |
*
|
|
|
|
| 308 |
/**
|
| 309 |
* Computes a hash value for a string using the djb2 algorithm.
|
| 310 |
*
|
| 311 |
+
* **When to use**
|
| 312 |
+
*
|
| 313 |
+
* Use when you need a string field to contribute to a custom structural hash
|
| 314 |
+
* implementation.
|
| 315 |
+
*
|
| 316 |
+
* **Details**
|
| 317 |
+
*
|
| 318 |
* This function implements a variation of the djb2 hash algorithm, which is
|
| 319 |
* known for its good distribution properties and speed. It processes each
|
| 320 |
* character of the string to produce a consistent hash value.
|
| 321 |
*
|
| 322 |
+
* **Example** (Hashing strings)
|
| 323 |
+
*
|
| 324 |
* ```ts
|
| 325 |
* import { Hash } from "effect"
|
| 326 |
*
|
|
|
|
| 346 |
/**
|
| 347 |
* Computes a hash value for an object using only the specified keys.
|
| 348 |
*
|
| 349 |
+
* **When to use**
|
| 350 |
+
*
|
| 351 |
+
* Use to hash an object by a selected set of property keys.
|
| 352 |
+
*
|
| 353 |
+
* **Details**
|
| 354 |
+
*
|
| 355 |
* This function allows you to hash an object by considering only specific keys,
|
| 356 |
* which is useful when you want to create a hash based on a subset of an object's
|
| 357 |
* properties.
|
| 358 |
*
|
| 359 |
+
* **Example** (Hashing selected object keys)
|
| 360 |
+
*
|
| 361 |
* ```ts
|
| 362 |
* import { Hash } from "effect"
|
| 363 |
*
|
|
|
|
| 387 |
return optimize(h);
|
| 388 |
};
|
| 389 |
/**
|
| 390 |
+
* Computes a structural hash for an object using Effect's object key collection.
|
| 391 |
+
*
|
| 392 |
+
* **When to use**
|
| 393 |
+
*
|
| 394 |
+
* Use to hash an object from all structural keys collected by Effect.
|
| 395 |
*
|
| 396 |
+
* **Details**
|
| 397 |
+
*
|
| 398 |
+
* The hash is based on the object's structural keys and their values, including
|
| 399 |
+
* symbol keys and relevant prototype keys for non-plain objects.
|
| 400 |
+
*
|
| 401 |
+
* **Example** (Hashing object structures)
|
| 402 |
*
|
|
|
|
| 403 |
* ```ts
|
| 404 |
* import { Hash } from "effect"
|
| 405 |
*
|
|
|
|
| 427 |
return optimize(h);
|
| 428 |
};
|
| 429 |
/**
|
| 430 |
+
* Computes a hash value for an iterable by hashing all of its elements.
|
| 431 |
+
*
|
| 432 |
+
* **When to use**
|
| 433 |
*
|
| 434 |
+
* Use to hash the values yielded by an iterable with Effect hash semantics.
|
| 435 |
+
*
|
| 436 |
+
* **Details**
|
| 437 |
+
*
|
| 438 |
+
* The implementation folds element hashes from the seed `6151` with XOR and
|
| 439 |
+
* then optimizes the final hash.
|
| 440 |
+
*
|
| 441 |
+
* **Gotchas**
|
| 442 |
+
*
|
| 443 |
+
* A hash is not an equality proof. Because this implementation uses XOR,
|
| 444 |
+
* reordered inputs can produce the same hash.
|
| 445 |
+
*
|
| 446 |
+
* **Example** (Hashing arrays)
|
| 447 |
*
|
|
|
|
| 448 |
* ```ts
|
| 449 |
* import { Hash } from "effect"
|
| 450 |
*
|
|
|
|
| 454 |
*
|
| 455 |
* console.log(Hash.array(arr1)) // hash of [1, 2, 3]
|
| 456 |
* console.log(Hash.array(arr2)) // same hash as arr1
|
| 457 |
+
* console.log(Hash.array(arr3)) // may match reordered inputs
|
| 458 |
*
|
|
|
|
| 459 |
* console.log(Hash.array(arr1) === Hash.array(arr2)) // true
|
| 460 |
+
* console.log(Hash.array(arr1) === Hash.array(arr3)) // true
|
| 461 |
* ```
|
| 462 |
*
|
| 463 |
+
* @see {@link hash} for the general-purpose hash dispatcher
|
| 464 |
+
*
|
| 465 |
* @category hashing
|
| 466 |
* @since 2.0.0
|
| 467 |
*/
|
.opencode/node_modules/effect/dist/Hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Hash.js","names":["dual","byReferenceInstances","getAllObjectKeys","hasProperty","symbol","hash","self","number","string","toString","String","Date","toISOString","RegExp","has","random","hashCache","get","h","withVisitedTracking","isHash","Array","isArray","ArrayBuffer","isView","array","Map","hashMap","Set","hashSet","structure","set","Error","randomHashCache","Math","floor","Number","MAX_SAFE_INTEGER","combine","b","optimize","n","u","Infinity","str","i","length","charCodeAt","structureKeys","o","keys","key","iterableWith","seed","f","iter","element","k","v","WeakMap","visitedObjects","WeakSet","obj","fn","add","result","delete"],"sources":["../src/Hash.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"Hash.js","names":["dual","byReferenceInstances","getAllObjectKeys","hasProperty","symbol","hash","self","number","string","toString","String","Date","toISOString","RegExp","has","random","hashCache","get","h","withVisitedTracking","isHash","Array","isArray","ArrayBuffer","isView","array","Map","hashMap","Set","hashSet","structure","set","Error","randomHashCache","Math","floor","Number","MAX_SAFE_INTEGER","combine","b","optimize","n","u","Infinity","str","i","length","charCodeAt","structureKeys","o","keys","key","iterableWith","seed","f","iter","element","k","v","WeakMap","visitedObjects","WeakSet","obj","fn","add","result","delete"],"sources":["../src/Hash.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,SAASA,IAAI,QAAQ,eAAe;AACpC,SAASC,oBAAoB,EAAEC,gBAAgB,QAAQ,qBAAqB;AAC5E,SAASC,WAAW,QAAQ,gBAAgB;AAE5C;;;;;;;;;;;;;;;AAeA,OAAO,MAAMC,MAAM,GAAG,yBAAyB;AAsC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,OAAO,MAAMC,IAAI,GAA+BC,IAAO,IAAI;EACzD,QAAQ,OAAOA,IAAI;IACjB,KAAK,QAAQ;MACX,OAAOC,MAAM,CAACD,IAAI,CAAC;IACrB,KAAK,QAAQ;MACX,OAAOE,MAAM,CAACF,IAAI,CAACG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,KAAK,SAAS;MACZ,OAAOD,MAAM,CAACE,MAAM,CAACJ,IAAI,CAAC,CAAC;IAC7B,KAAK,QAAQ;MACX,OAAOE,MAAM,CAACE,MAAM,CAACJ,IAAI,CAAC,CAAC;IAC7B,KAAK,QAAQ;MACX,OAAOE,MAAM,CAACF,IAAI,CAAC;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+1,12 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 2.0.0
|
| 3 |
*/
|
| 4 |
import type { Equal } from "./Equal.ts";
|
|
@@ -13,9 +21,10 @@ declare const TypeId = "~effect/collections/HashMap";
|
|
| 13 |
* insertion, and deletion operations. It uses a Hash Array Mapped Trie (HAMT) internally
|
| 14 |
* for structural sharing and optimal performance.
|
| 15 |
*
|
| 16 |
-
*
|
|
|
|
| 17 |
* ```ts
|
| 18 |
-
* import
|
| 19 |
*
|
| 20 |
* // Create a HashMap
|
| 21 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
@@ -32,8 +41,8 @@ declare const TypeId = "~effect/collections/HashMap";
|
|
| 32 |
* console.log(HashMap.size(updated)) // 4
|
| 33 |
* ```
|
| 34 |
*
|
| 35 |
-
* @since 2.0.0
|
| 36 |
* @category models
|
|
|
|
| 37 |
*/
|
| 38 |
export interface HashMap<out Key, out Value> extends Iterable<[Key, Value]>, Equal, Pipeable, Inspectable {
|
| 39 |
readonly [TypeId]: typeof TypeId;
|
|
@@ -42,9 +51,10 @@ export interface HashMap<out Key, out Value> extends Iterable<[Key, Value]>, Equ
|
|
| 42 |
* The HashMap namespace contains type-level utilities and helper types
|
| 43 |
* for working with HashMap instances.
|
| 44 |
*
|
| 45 |
-
*
|
|
|
|
| 46 |
* ```ts
|
| 47 |
-
* import
|
| 48 |
*
|
| 49 |
* // Create a concrete HashMap for type extraction
|
| 50 |
* const inventory = HashMap.make(
|
|
@@ -70,7 +80,6 @@ export interface HashMap<out Key, out Value> extends Iterable<[Key, Value]>, Equ
|
|
| 70 |
* ```
|
| 71 |
*
|
| 72 |
* @since 2.0.0
|
| 73 |
-
* @category models
|
| 74 |
*/
|
| 75 |
export declare namespace HashMap {
|
| 76 |
/**
|
|
@@ -78,10 +87,10 @@ export declare namespace HashMap {
|
|
| 78 |
* Takes an Option representing the current value and returns an Option
|
| 79 |
* representing the new value.
|
| 80 |
*
|
| 81 |
-
*
|
|
|
|
| 82 |
* ```ts
|
| 83 |
-
* import
|
| 84 |
-
* import * as Option from "effect/Option"
|
| 85 |
*
|
| 86 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 87 |
*
|
|
@@ -93,16 +102,17 @@ export declare namespace HashMap {
|
|
| 93 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 94 |
* ```
|
| 95 |
*
|
| 96 |
-
* @since 2.0.0
|
| 97 |
* @category models
|
|
|
|
| 98 |
*/
|
| 99 |
type UpdateFn<V> = (option: Option<V>) => Option<V>;
|
| 100 |
/**
|
| 101 |
* This type-level utility extracts the key type `K` from a `HashMap<K, V>` type.
|
| 102 |
*
|
| 103 |
-
*
|
|
|
|
| 104 |
* ```ts
|
| 105 |
-
* import
|
| 106 |
*
|
| 107 |
* // Create a HashMap to extract key type from
|
| 108 |
* const userMap = HashMap.make(
|
|
@@ -117,16 +127,18 @@ export declare namespace HashMap {
|
|
| 117 |
* const getUserById = (id: UserKey) => HashMap.get(userMap, id)
|
| 118 |
* console.log(getUserById("alice")) // Option.some({ name: "Alice", age: 30 })
|
| 119 |
* ```
|
|
|
|
|
|
|
| 120 |
* @since 2.0.0
|
| 121 |
-
* @category type-level
|
| 122 |
*/
|
| 123 |
type Key<T extends HashMap<any, any>> = [T] extends [HashMap<infer _K, infer _V>] ? _K : never;
|
| 124 |
/**
|
| 125 |
* This type-level utility extracts the value type `V` from a `HashMap<K, V>` type.
|
| 126 |
*
|
| 127 |
-
*
|
|
|
|
| 128 |
* ```ts
|
| 129 |
-
* import
|
| 130 |
*
|
| 131 |
* // Create a HashMap with user data
|
| 132 |
* const userMap = HashMap.make(
|
|
@@ -145,16 +157,18 @@ export declare namespace HashMap {
|
|
| 145 |
* const alice = HashMap.get(userMap, "alice")
|
| 146 |
* // alice has type Option<User> thanks to type extraction
|
| 147 |
* ```
|
|
|
|
|
|
|
| 148 |
* @since 2.0.0
|
| 149 |
-
* @category type-level
|
| 150 |
*/
|
| 151 |
type Value<T extends HashMap<any, any>> = [T] extends [HashMap<infer _K, infer _V>] ? _V : never;
|
| 152 |
/**
|
| 153 |
* This type-level utility extracts the entry type `[K, V]` from a `HashMap<K, V>` type.
|
| 154 |
*
|
| 155 |
-
*
|
|
|
|
| 156 |
* ```ts
|
| 157 |
-
* import
|
| 158 |
*
|
| 159 |
* // Create a product catalog HashMap
|
| 160 |
* const catalog = HashMap.make(
|
|
@@ -170,21 +184,23 @@ export declare namespace HashMap {
|
|
| 170 |
* return `${productId}: $${product.price} (${product.category})`
|
| 171 |
* }
|
| 172 |
*
|
| 173 |
-
* // Convert to entries and
|
| 174 |
-
* const descriptions = HashMap.toEntries(catalog).map(processEntry)
|
| 175 |
-
* console.log(descriptions) // ["
|
| 176 |
* ```
|
|
|
|
|
|
|
| 177 |
* @since 3.9.0
|
| 178 |
-
* @category type-level
|
| 179 |
*/
|
| 180 |
type Entry<T extends HashMap<any, any>> = [Key<T>, Value<T>];
|
| 181 |
}
|
| 182 |
/**
|
| 183 |
-
* Checks
|
|
|
|
|
|
|
| 184 |
*
|
| 185 |
-
* @example
|
| 186 |
* ```ts
|
| 187 |
-
* import
|
| 188 |
*
|
| 189 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 190 |
* const notMap = { a: 1 }
|
|
@@ -194,16 +210,17 @@ export declare namespace HashMap {
|
|
| 194 |
* console.log(HashMap.isHashMap(null)) // false
|
| 195 |
* ```
|
| 196 |
*
|
| 197 |
-
* @since 2.0.0
|
| 198 |
* @category refinements
|
|
|
|
| 199 |
*/
|
| 200 |
export declare const isHashMap: {
|
| 201 |
/**
|
| 202 |
-
* Checks
|
|
|
|
|
|
|
| 203 |
*
|
| 204 |
-
* @example
|
| 205 |
* ```ts
|
| 206 |
-
* import
|
| 207 |
*
|
| 208 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 209 |
* const notMap = { a: 1 }
|
|
@@ -213,16 +230,17 @@ export declare const isHashMap: {
|
|
| 213 |
* console.log(HashMap.isHashMap(null)) // false
|
| 214 |
* ```
|
| 215 |
*
|
| 216 |
-
* @since 2.0.0
|
| 217 |
* @category refinements
|
|
|
|
| 218 |
*/
|
| 219 |
<K, V>(u: Iterable<readonly [K, V]>): u is HashMap<K, V>;
|
| 220 |
/**
|
| 221 |
-
* Checks
|
|
|
|
|
|
|
| 222 |
*
|
| 223 |
-
* @example
|
| 224 |
* ```ts
|
| 225 |
-
* import
|
| 226 |
*
|
| 227 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 228 |
* const notMap = { a: 1 }
|
|
@@ -232,49 +250,52 @@ export declare const isHashMap: {
|
|
| 232 |
* console.log(HashMap.isHashMap(null)) // false
|
| 233 |
* ```
|
| 234 |
*
|
| 235 |
-
* @since 2.0.0
|
| 236 |
* @category refinements
|
|
|
|
| 237 |
*/
|
| 238 |
(u: unknown): u is HashMap<unknown, unknown>;
|
| 239 |
};
|
| 240 |
/**
|
| 241 |
* Creates a new empty `HashMap`.
|
| 242 |
*
|
| 243 |
-
*
|
|
|
|
| 244 |
* ```ts
|
| 245 |
-
* import
|
| 246 |
*
|
| 247 |
* const map = HashMap.empty<string, number>()
|
| 248 |
* console.log(HashMap.isEmpty(map)) // true
|
| 249 |
* console.log(HashMap.size(map)) // 0
|
| 250 |
* ```
|
| 251 |
*
|
| 252 |
-
* @since 2.0.0
|
| 253 |
* @category constructors
|
|
|
|
| 254 |
*/
|
| 255 |
export declare const empty: <K = never, V = never>() => HashMap<K, V>;
|
| 256 |
/**
|
| 257 |
* Constructs a new `HashMap` from an array of key/value pairs.
|
| 258 |
*
|
| 259 |
-
*
|
|
|
|
| 260 |
* ```ts
|
| 261 |
-
* import
|
| 262 |
*
|
| 263 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 264 |
* console.log(HashMap.size(map)) // 3
|
| 265 |
* console.log(HashMap.get(map, "b")) // Option.some(2)
|
| 266 |
* ```
|
| 267 |
*
|
| 268 |
-
* @since 2.0.0
|
| 269 |
* @category constructors
|
|
|
|
| 270 |
*/
|
| 271 |
export declare const make: <Entries extends ReadonlyArray<readonly [any, any]>>(...entries: Entries) => HashMap<Entries[number] extends readonly [infer K, any] ? K : never, Entries[number] extends readonly [any, infer V] ? V : never>;
|
| 272 |
/**
|
| 273 |
* Creates a new `HashMap` from an iterable collection of key/value pairs.
|
| 274 |
*
|
| 275 |
-
*
|
|
|
|
| 276 |
* ```ts
|
| 277 |
-
* import
|
| 278 |
*
|
| 279 |
* const entries = [["a", 1], ["b", 2], ["c", 3]] as const
|
| 280 |
* const map = HashMap.fromIterable(entries)
|
|
@@ -282,16 +303,17 @@ export declare const make: <Entries extends ReadonlyArray<readonly [any, any]>>(
|
|
| 282 |
* console.log(HashMap.get(map, "a")) // Option.some(1)
|
| 283 |
* ```
|
| 284 |
*
|
| 285 |
-
* @since 2.0.0
|
| 286 |
* @category constructors
|
|
|
|
| 287 |
*/
|
| 288 |
export declare const fromIterable: <K, V>(entries: Iterable<readonly [K, V]>) => HashMap<K, V>;
|
| 289 |
/**
|
| 290 |
-
* Checks
|
|
|
|
|
|
|
| 291 |
*
|
| 292 |
-
* @example
|
| 293 |
* ```ts
|
| 294 |
-
* import
|
| 295 |
*
|
| 296 |
* const emptyMap = HashMap.empty<string, number>()
|
| 297 |
* const nonEmptyMap = HashMap.make(["a", 1])
|
|
@@ -300,17 +322,18 @@ export declare const fromIterable: <K, V>(entries: Iterable<readonly [K, V]>) =>
|
|
| 300 |
* console.log(HashMap.isEmpty(nonEmptyMap)) // false
|
| 301 |
* ```
|
| 302 |
*
|
| 303 |
-
* @since 2.0.0
|
| 304 |
* @category elements
|
|
|
|
| 305 |
*/
|
| 306 |
export declare const isEmpty: <K, V>(self: HashMap<K, V>) => boolean;
|
| 307 |
/**
|
| 308 |
-
*
|
| 309 |
* internal hashing function.
|
| 310 |
*
|
| 311 |
-
*
|
|
|
|
| 312 |
* ```ts
|
| 313 |
-
* import
|
| 314 |
*
|
| 315 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 316 |
*
|
|
@@ -322,17 +345,18 @@ export declare const isEmpty: <K, V>(self: HashMap<K, V>) => boolean;
|
|
| 322 |
* console.log(value) // Option.some(2)
|
| 323 |
* ```
|
| 324 |
*
|
| 325 |
-
* @since 2.0.0
|
| 326 |
* @category elements
|
|
|
|
| 327 |
*/
|
| 328 |
export declare const get: {
|
| 329 |
/**
|
| 330 |
-
*
|
| 331 |
* internal hashing function.
|
| 332 |
*
|
| 333 |
-
*
|
|
|
|
| 334 |
* ```ts
|
| 335 |
-
* import
|
| 336 |
*
|
| 337 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 338 |
*
|
|
@@ -344,17 +368,18 @@ export declare const get: {
|
|
| 344 |
* console.log(value) // Option.some(2)
|
| 345 |
* ```
|
| 346 |
*
|
| 347 |
-
* @since 2.0.0
|
| 348 |
* @category elements
|
|
|
|
| 349 |
*/
|
| 350 |
<K1 extends K, K>(key: K1): <V>(self: HashMap<K, V>) => Option<V>;
|
| 351 |
/**
|
| 352 |
-
*
|
| 353 |
* internal hashing function.
|
| 354 |
*
|
| 355 |
-
*
|
|
|
|
| 356 |
* ```ts
|
| 357 |
-
* import
|
| 358 |
*
|
| 359 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 360 |
*
|
|
@@ -366,18 +391,18 @@ export declare const get: {
|
|
| 366 |
* console.log(value) // Option.some(2)
|
| 367 |
* ```
|
| 368 |
*
|
| 369 |
-
* @since 2.0.0
|
| 370 |
* @category elements
|
|
|
|
| 371 |
*/
|
| 372 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): Option<V>;
|
| 373 |
};
|
| 374 |
/**
|
| 375 |
-
*
|
|
|
|
|
|
|
| 376 |
*
|
| 377 |
-
* @example
|
| 378 |
* ```ts
|
| 379 |
-
* import { Hash } from "effect"
|
| 380 |
-
* import * as HashMap from "effect/HashMap"
|
| 381 |
*
|
| 382 |
* // Useful when implementing custom equality for complex keys
|
| 383 |
* const userMap = HashMap.make(
|
|
@@ -398,17 +423,17 @@ export declare const get: {
|
|
| 398 |
* console.log(notFound) // Option.none()
|
| 399 |
* ```
|
| 400 |
*
|
| 401 |
-
* @since 2.0.0
|
| 402 |
* @category elements
|
|
|
|
| 403 |
*/
|
| 404 |
export declare const getHash: {
|
| 405 |
/**
|
| 406 |
-
*
|
|
|
|
|
|
|
| 407 |
*
|
| 408 |
-
* @example
|
| 409 |
* ```ts
|
| 410 |
-
* import { Hash } from "effect"
|
| 411 |
-
* import * as HashMap from "effect/HashMap"
|
| 412 |
*
|
| 413 |
* // Useful when implementing custom equality for complex keys
|
| 414 |
* const userMap = HashMap.make(
|
|
@@ -429,17 +454,17 @@ export declare const getHash: {
|
|
| 429 |
* console.log(notFound) // Option.none()
|
| 430 |
* ```
|
| 431 |
*
|
| 432 |
-
* @since 2.0.0
|
| 433 |
* @category elements
|
|
|
|
| 434 |
*/
|
| 435 |
<K1 extends K, K>(key: K1, hash: number): <V>(self: HashMap<K, V>) => Option<V>;
|
| 436 |
/**
|
| 437 |
-
*
|
|
|
|
|
|
|
| 438 |
*
|
| 439 |
-
* @example
|
| 440 |
* ```ts
|
| 441 |
-
* import { Hash } from "effect"
|
| 442 |
-
* import * as HashMap from "effect/HashMap"
|
| 443 |
*
|
| 444 |
* // Useful when implementing custom equality for complex keys
|
| 445 |
* const userMap = HashMap.make(
|
|
@@ -460,22 +485,29 @@ export declare const getHash: {
|
|
| 460 |
* console.log(notFound) // Option.none()
|
| 461 |
* ```
|
| 462 |
*
|
| 463 |
-
* @since 2.0.0
|
| 464 |
* @category elements
|
|
|
|
| 465 |
*/
|
| 466 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1, hash: number): Option<V>;
|
| 467 |
};
|
| 468 |
/**
|
| 469 |
-
*
|
| 470 |
* internal hashing function.
|
| 471 |
*
|
| 472 |
-
*
|
| 473 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
*
|
| 475 |
-
* @example
|
| 476 |
* ```ts
|
| 477 |
-
* import
|
| 478 |
-
* import * as Option from "effect/Option"
|
| 479 |
*
|
| 480 |
* const config = HashMap.make(
|
| 481 |
* ["api_url", "https://api.example.com"],
|
|
@@ -497,21 +529,28 @@ export declare const getHash: {
|
|
| 497 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 498 |
* ```
|
| 499 |
*
|
| 500 |
-
* @since 2.0.0
|
| 501 |
* @category unsafe
|
|
|
|
| 502 |
*/
|
| 503 |
export declare const getUnsafe: {
|
| 504 |
/**
|
| 505 |
-
*
|
| 506 |
* internal hashing function.
|
| 507 |
*
|
| 508 |
-
*
|
| 509 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 510 |
*
|
| 511 |
-
* @example
|
| 512 |
* ```ts
|
| 513 |
-
* import
|
| 514 |
-
* import * as Option from "effect/Option"
|
| 515 |
*
|
| 516 |
* const config = HashMap.make(
|
| 517 |
* ["api_url", "https://api.example.com"],
|
|
@@ -533,21 +572,28 @@ export declare const getUnsafe: {
|
|
| 533 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 534 |
* ```
|
| 535 |
*
|
| 536 |
-
* @since 2.0.0
|
| 537 |
* @category unsafe
|
|
|
|
| 538 |
*/
|
| 539 |
<K1 extends K, K>(key: K1): <V>(self: HashMap<K, V>) => V;
|
| 540 |
/**
|
| 541 |
-
*
|
| 542 |
* internal hashing function.
|
| 543 |
*
|
| 544 |
-
*
|
| 545 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 546 |
*
|
| 547 |
-
* @example
|
| 548 |
* ```ts
|
| 549 |
-
* import
|
| 550 |
-
* import * as Option from "effect/Option"
|
| 551 |
*
|
| 552 |
* const config = HashMap.make(
|
| 553 |
* ["api_url", "https://api.example.com"],
|
|
@@ -569,17 +615,18 @@ export declare const getUnsafe: {
|
|
| 569 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 570 |
* ```
|
| 571 |
*
|
| 572 |
-
* @since 2.0.0
|
| 573 |
* @category unsafe
|
|
|
|
| 574 |
*/
|
| 575 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): V;
|
| 576 |
};
|
| 577 |
/**
|
| 578 |
-
* Checks
|
|
|
|
|
|
|
| 579 |
*
|
| 580 |
-
* @example
|
| 581 |
* ```ts
|
| 582 |
-
* import
|
| 583 |
*
|
| 584 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 585 |
*
|
|
@@ -591,16 +638,17 @@ export declare const getUnsafe: {
|
|
| 591 |
* console.log(hasB) // true
|
| 592 |
* ```
|
| 593 |
*
|
| 594 |
-
* @since 2.0.0
|
| 595 |
* @category elements
|
|
|
|
| 596 |
*/
|
| 597 |
export declare const has: {
|
| 598 |
/**
|
| 599 |
-
* Checks
|
|
|
|
|
|
|
| 600 |
*
|
| 601 |
-
* @example
|
| 602 |
* ```ts
|
| 603 |
-
* import
|
| 604 |
*
|
| 605 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 606 |
*
|
|
@@ -612,16 +660,17 @@ export declare const has: {
|
|
| 612 |
* console.log(hasB) // true
|
| 613 |
* ```
|
| 614 |
*
|
| 615 |
-
* @since 2.0.0
|
| 616 |
* @category elements
|
|
|
|
| 617 |
*/
|
| 618 |
<K1 extends K, K>(key: K1): <K, V>(self: HashMap<K, V>) => boolean;
|
| 619 |
/**
|
| 620 |
-
* Checks
|
|
|
|
|
|
|
| 621 |
*
|
| 622 |
-
* @example
|
| 623 |
* ```ts
|
| 624 |
-
* import
|
| 625 |
*
|
| 626 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 627 |
*
|
|
@@ -633,19 +682,19 @@ export declare const has: {
|
|
| 633 |
* console.log(hasB) // true
|
| 634 |
* ```
|
| 635 |
*
|
| 636 |
-
* @since 2.0.0
|
| 637 |
* @category elements
|
|
|
|
| 638 |
*/
|
| 639 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): boolean;
|
| 640 |
};
|
| 641 |
/**
|
| 642 |
-
* Checks
|
| 643 |
* hash.
|
| 644 |
*
|
| 645 |
-
*
|
|
|
|
| 646 |
* ```ts
|
| 647 |
-
* import { Hash } from "effect"
|
| 648 |
-
* import * as HashMap from "effect/HashMap"
|
| 649 |
*
|
| 650 |
* // Create a map with case-sensitive keys
|
| 651 |
* const userMap = HashMap.make(
|
|
@@ -657,23 +706,26 @@ export declare const has: {
|
|
| 657 |
* const exactHash = Hash.string("Admin")
|
| 658 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 659 |
*
|
| 660 |
-
* //
|
| 661 |
-
*
|
| 662 |
-
*
|
|
|
|
|
|
|
|
|
|
| 663 |
* ```
|
| 664 |
*
|
| 665 |
-
* @since 2.0.0
|
| 666 |
* @category elements
|
|
|
|
| 667 |
*/
|
| 668 |
export declare const hasHash: {
|
| 669 |
/**
|
| 670 |
-
* Checks
|
| 671 |
* hash.
|
| 672 |
*
|
| 673 |
-
*
|
|
|
|
| 674 |
* ```ts
|
| 675 |
-
* import { Hash } from "effect"
|
| 676 |
-
* import * as HashMap from "effect/HashMap"
|
| 677 |
*
|
| 678 |
* // Create a map with case-sensitive keys
|
| 679 |
* const userMap = HashMap.make(
|
|
@@ -685,23 +737,26 @@ export declare const hasHash: {
|
|
| 685 |
* const exactHash = Hash.string("Admin")
|
| 686 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 687 |
*
|
| 688 |
-
* //
|
| 689 |
-
*
|
| 690 |
-
*
|
|
|
|
|
|
|
|
|
|
| 691 |
* ```
|
| 692 |
*
|
| 693 |
-
* @since 2.0.0
|
| 694 |
* @category elements
|
|
|
|
| 695 |
*/
|
| 696 |
<K1 extends K, K>(key: K1, hash: number): <V>(self: HashMap<K, V>) => boolean;
|
| 697 |
/**
|
| 698 |
-
* Checks
|
| 699 |
* hash.
|
| 700 |
*
|
| 701 |
-
*
|
|
|
|
| 702 |
* ```ts
|
| 703 |
-
* import { Hash } from "effect"
|
| 704 |
-
* import * as HashMap from "effect/HashMap"
|
| 705 |
*
|
| 706 |
* // Create a map with case-sensitive keys
|
| 707 |
* const userMap = HashMap.make(
|
|
@@ -713,62 +768,68 @@ export declare const hasHash: {
|
|
| 713 |
* const exactHash = Hash.string("Admin")
|
| 714 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 715 |
*
|
| 716 |
-
* //
|
| 717 |
-
*
|
| 718 |
-
*
|
|
|
|
|
|
|
|
|
|
| 719 |
* ```
|
| 720 |
*
|
| 721 |
-
* @since 2.0.0
|
| 722 |
* @category elements
|
|
|
|
| 723 |
*/
|
| 724 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1, hash: number): boolean;
|
| 725 |
};
|
| 726 |
/**
|
| 727 |
-
* Checks
|
|
|
|
|
|
|
| 728 |
*
|
| 729 |
-
* @example
|
| 730 |
* ```ts
|
| 731 |
-
* import
|
| 732 |
*
|
| 733 |
* const hm = HashMap.make([1, "a"])
|
| 734 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 735 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 736 |
* ```
|
| 737 |
*
|
| 738 |
-
* @since 3.16.0
|
| 739 |
* @category elements
|
|
|
|
| 740 |
*/
|
| 741 |
export declare const hasBy: {
|
| 742 |
/**
|
| 743 |
-
* Checks
|
|
|
|
|
|
|
| 744 |
*
|
| 745 |
-
* @example
|
| 746 |
* ```ts
|
| 747 |
-
* import
|
| 748 |
*
|
| 749 |
* const hm = HashMap.make([1, "a"])
|
| 750 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 751 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 752 |
* ```
|
| 753 |
*
|
| 754 |
-
* @since 3.16.0
|
| 755 |
* @category elements
|
|
|
|
| 756 |
*/
|
| 757 |
<K, V>(predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): (self: HashMap<K, V>) => boolean;
|
| 758 |
/**
|
| 759 |
-
* Checks
|
|
|
|
|
|
|
| 760 |
*
|
| 761 |
-
* @example
|
| 762 |
* ```ts
|
| 763 |
-
* import
|
| 764 |
*
|
| 765 |
* const hm = HashMap.make([1, "a"])
|
| 766 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 767 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 768 |
* ```
|
| 769 |
*
|
| 770 |
-
* @since 3.16.0
|
| 771 |
* @category elements
|
|
|
|
| 772 |
*/
|
| 773 |
<K, V>(self: HashMap<K, V>, predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): boolean;
|
| 774 |
};
|
|
@@ -776,9 +837,10 @@ export declare const hasBy: {
|
|
| 776 |
* Sets the specified key to the specified value using the internal hashing
|
| 777 |
* function.
|
| 778 |
*
|
| 779 |
-
*
|
|
|
|
| 780 |
* ```ts
|
| 781 |
-
* import
|
| 782 |
*
|
| 783 |
* const map1 = HashMap.make(["a", 1])
|
| 784 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
@@ -790,17 +852,18 @@ export declare const hasBy: {
|
|
| 790 |
* console.log(HashMap.size(map1)) // 1
|
| 791 |
* ```
|
| 792 |
*
|
|
|
|
| 793 |
* @since 2.0.0
|
| 794 |
-
* @category transformations
|
| 795 |
*/
|
| 796 |
export declare const set: {
|
| 797 |
/**
|
| 798 |
* Sets the specified key to the specified value using the internal hashing
|
| 799 |
* function.
|
| 800 |
*
|
| 801 |
-
*
|
|
|
|
| 802 |
* ```ts
|
| 803 |
-
* import
|
| 804 |
*
|
| 805 |
* const map1 = HashMap.make(["a", 1])
|
| 806 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
@@ -812,17 +875,18 @@ export declare const set: {
|
|
| 812 |
* console.log(HashMap.size(map1)) // 1
|
| 813 |
* ```
|
| 814 |
*
|
|
|
|
| 815 |
* @since 2.0.0
|
| 816 |
-
* @category transformations
|
| 817 |
*/
|
| 818 |
<K, V>(key: K, value: V): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 819 |
/**
|
| 820 |
* Sets the specified key to the specified value using the internal hashing
|
| 821 |
* function.
|
| 822 |
*
|
| 823 |
-
*
|
|
|
|
| 824 |
* ```ts
|
| 825 |
-
* import
|
| 826 |
*
|
| 827 |
* const map1 = HashMap.make(["a", 1])
|
| 828 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
@@ -834,49 +898,52 @@ export declare const set: {
|
|
| 834 |
* console.log(HashMap.size(map1)) // 1
|
| 835 |
* ```
|
| 836 |
*
|
|
|
|
| 837 |
* @since 2.0.0
|
| 838 |
-
* @category transformations
|
| 839 |
*/
|
| 840 |
<K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V>;
|
| 841 |
};
|
| 842 |
/**
|
| 843 |
* Returns an `IterableIterator` of the keys within the `HashMap`.
|
| 844 |
*
|
| 845 |
-
*
|
|
|
|
| 846 |
* ```ts
|
| 847 |
-
* import
|
| 848 |
*
|
| 849 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 850 |
* const keys = Array.from(HashMap.keys(map))
|
| 851 |
* console.log(keys.sort()) // ["a", "b", "c"]
|
| 852 |
* ```
|
| 853 |
*
|
| 854 |
-
* @since 2.0.0
|
| 855 |
* @category getters
|
|
|
|
| 856 |
*/
|
| 857 |
export declare const keys: <K, V>(self: HashMap<K, V>) => IterableIterator<K>;
|
| 858 |
/**
|
| 859 |
* Returns an `IterableIterator` of the values within the `HashMap`.
|
| 860 |
*
|
| 861 |
-
*
|
|
|
|
| 862 |
* ```ts
|
| 863 |
-
* import
|
| 864 |
*
|
| 865 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 866 |
* const values = Array.from(HashMap.values(map))
|
| 867 |
* console.log(values.sort()) // [1, 2, 3]
|
| 868 |
* ```
|
| 869 |
*
|
| 870 |
-
* @since 2.0.0
|
| 871 |
* @category getters
|
|
|
|
| 872 |
*/
|
| 873 |
export declare const values: <K, V>(self: HashMap<K, V>) => IterableIterator<V>;
|
| 874 |
/**
|
| 875 |
* Returns an `Array` of the values within the `HashMap`.
|
| 876 |
*
|
| 877 |
-
*
|
|
|
|
| 878 |
* ```ts
|
| 879 |
-
* import
|
| 880 |
*
|
| 881 |
* const employees = HashMap.make(
|
| 882 |
* ["alice", { department: "engineering", salary: 90000 }],
|
|
@@ -897,16 +964,17 @@ export declare const values: <K, V>(self: HashMap<K, V>) => IterableIterator<V>;
|
|
| 897 |
* console.log(engineers.length) // 2
|
| 898 |
* ```
|
| 899 |
*
|
| 900 |
-
* @since 3.13.0
|
| 901 |
* @category getters
|
|
|
|
| 902 |
*/
|
| 903 |
export declare const toValues: <K, V>(self: HashMap<K, V>) => Array<V>;
|
| 904 |
/**
|
| 905 |
* Returns an `IterableIterator` of the entries within the `HashMap`.
|
| 906 |
*
|
| 907 |
-
*
|
|
|
|
| 908 |
* ```ts
|
| 909 |
-
* import
|
| 910 |
*
|
| 911 |
* // Create a configuration map
|
| 912 |
* const config = HashMap.make(
|
|
@@ -915,32 +983,30 @@ export declare const toValues: <K, V>(self: HashMap<K, V>) => Array<V>;
|
|
| 915 |
* ["cache.enabled", "true"]
|
| 916 |
* )
|
| 917 |
*
|
| 918 |
-
* //
|
| 919 |
-
* const
|
|
|
|
|
|
|
| 920 |
*
|
| 921 |
-
*
|
| 922 |
-
*
|
| 923 |
-
* console.log(`Setting ${key} = ${value}`)
|
| 924 |
-
* }
|
| 925 |
-
* // Setting database.host = localhost
|
| 926 |
-
* // Setting database.port = 5432
|
| 927 |
-
* // Setting cache.enabled = true
|
| 928 |
*
|
| 929 |
* // Convert to array when you need all entries at once
|
| 930 |
* const allEntries = Array.from(HashMap.entries(config))
|
| 931 |
* console.log(allEntries.length) // 3
|
| 932 |
* ```
|
| 933 |
*
|
| 934 |
-
* @since 2.0.0
|
| 935 |
* @category getters
|
|
|
|
| 936 |
*/
|
| 937 |
export declare const entries: <K, V>(self: HashMap<K, V>) => IterableIterator<[K, V]>;
|
| 938 |
/**
|
| 939 |
* Returns an `Array<[K, V]>` of the entries within the `HashMap`.
|
| 940 |
*
|
| 941 |
-
*
|
|
|
|
| 942 |
* ```ts
|
| 943 |
-
* import
|
| 944 |
*
|
| 945 |
* const gameScores = HashMap.make(
|
| 946 |
* ["alice", 1250],
|
|
@@ -963,16 +1029,17 @@ export declare const entries: <K, V>(self: HashMap<K, V>) => IterableIterator<[K
|
|
| 963 |
* const sortedMap = HashMap.fromIterable(scoreEntries)
|
| 964 |
* ```
|
| 965 |
*
|
| 966 |
-
* @since 2.0.0
|
| 967 |
* @category getters
|
|
|
|
| 968 |
*/
|
| 969 |
export declare const toEntries: <K, V>(self: HashMap<K, V>) => Array<[K, V]>;
|
| 970 |
/**
|
| 971 |
* Returns the number of entries within the `HashMap`.
|
| 972 |
*
|
| 973 |
-
*
|
|
|
|
| 974 |
* ```ts
|
| 975 |
-
* import
|
| 976 |
*
|
| 977 |
* const emptyMap = HashMap.empty<string, number>()
|
| 978 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
@@ -981,16 +1048,22 @@ export declare const toEntries: <K, V>(self: HashMap<K, V>) => Array<[K, V]>;
|
|
| 981 |
* console.log(HashMap.size(map)) // 3
|
| 982 |
* ```
|
| 983 |
*
|
| 984 |
-
* @since 2.0.0
|
| 985 |
* @category getters
|
|
|
|
| 986 |
*/
|
| 987 |
export declare const size: <K, V>(self: HashMap<K, V>) => number;
|
| 988 |
/**
|
| 989 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 990 |
*
|
| 991 |
-
* @example
|
| 992 |
* ```ts
|
| 993 |
-
* import
|
| 994 |
*
|
| 995 |
* const map = HashMap.make(["a", 1])
|
| 996 |
*
|
|
@@ -1007,16 +1080,17 @@ export declare const size: <K, V>(self: HashMap<K, V>) => number;
|
|
| 1007 |
* console.log(HashMap.size(result)) // 2
|
| 1008 |
* ```
|
| 1009 |
*
|
| 1010 |
-
* @since 2.0.0
|
| 1011 |
* @category mutations
|
|
|
|
| 1012 |
*/
|
| 1013 |
export declare const beginMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1014 |
/**
|
| 1015 |
* Marks the `HashMap` as immutable, completing the mutation cycle.
|
| 1016 |
*
|
| 1017 |
-
*
|
|
|
|
| 1018 |
* ```ts
|
| 1019 |
-
* import
|
| 1020 |
*
|
| 1021 |
* // Start with an existing map
|
| 1022 |
* const original = HashMap.make(["x", 10], ["y", 20])
|
|
@@ -1037,16 +1111,23 @@ export declare const beginMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>
|
|
| 1037 |
* console.log(HashMap.get(final, "z")) // Option.some(30)
|
| 1038 |
* ```
|
| 1039 |
*
|
| 1040 |
-
* @since 2.0.0
|
| 1041 |
* @category mutations
|
|
|
|
| 1042 |
*/
|
| 1043 |
export declare const endMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1044 |
/**
|
| 1045 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1046 |
*
|
| 1047 |
-
* @example
|
| 1048 |
* ```ts
|
| 1049 |
-
* import
|
| 1050 |
*
|
| 1051 |
* const map1 = HashMap.make(["a", 1])
|
| 1052 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
@@ -1056,16 +1137,23 @@ export declare const endMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>;
|
|
| 1056 |
* // Returns a new HashMap with mutations applied
|
| 1057 |
* ```
|
| 1058 |
*
|
| 1059 |
-
* @since 2.0.0
|
| 1060 |
* @category mutations
|
|
|
|
| 1061 |
*/
|
| 1062 |
export declare const mutate: {
|
| 1063 |
/**
|
| 1064 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1065 |
*
|
| 1066 |
-
* @example
|
| 1067 |
* ```ts
|
| 1068 |
-
* import
|
| 1069 |
*
|
| 1070 |
* const map1 = HashMap.make(["a", 1])
|
| 1071 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
@@ -1075,16 +1163,23 @@ export declare const mutate: {
|
|
| 1075 |
* // Returns a new HashMap with mutations applied
|
| 1076 |
* ```
|
| 1077 |
*
|
| 1078 |
-
* @since 2.0.0
|
| 1079 |
* @category mutations
|
|
|
|
| 1080 |
*/
|
| 1081 |
<K, V>(f: (self: HashMap<K, V>) => void): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1082 |
/**
|
| 1083 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1084 |
*
|
| 1085 |
-
* @example
|
| 1086 |
* ```ts
|
| 1087 |
-
* import
|
| 1088 |
*
|
| 1089 |
* const map1 = HashMap.make(["a", 1])
|
| 1090 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
@@ -1094,23 +1189,24 @@ export declare const mutate: {
|
|
| 1094 |
* // Returns a new HashMap with mutations applied
|
| 1095 |
* ```
|
| 1096 |
*
|
| 1097 |
-
* @since 2.0.0
|
| 1098 |
* @category mutations
|
|
|
|
| 1099 |
*/
|
| 1100 |
<K, V>(self: HashMap<K, V>, f: (self: HashMap<K, V>) => void): HashMap<K, V>;
|
| 1101 |
};
|
| 1102 |
/**
|
| 1103 |
-
*
|
| 1104 |
-
* update function. The value of the specified key will be computed using the
|
| 1105 |
-
* provided hash.
|
| 1106 |
*
|
| 1107 |
-
*
|
| 1108 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1109 |
*
|
| 1110 |
-
* @example
|
| 1111 |
* ```ts
|
| 1112 |
-
* import
|
| 1113 |
-
* import * as Option from "effect/Option"
|
| 1114 |
*
|
| 1115 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1116 |
*
|
|
@@ -1122,22 +1218,23 @@ export declare const mutate: {
|
|
| 1122 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1123 |
* ```
|
| 1124 |
*
|
|
|
|
| 1125 |
* @since 2.0.0
|
| 1126 |
-
* @category transformations
|
| 1127 |
*/
|
| 1128 |
export declare const modifyAt: {
|
| 1129 |
/**
|
| 1130 |
-
*
|
| 1131 |
-
*
|
| 1132 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
*
|
| 1134 |
-
*
|
| 1135 |
-
* exists, or `None` if no such value exists.
|
| 1136 |
*
|
| 1137 |
-
* @example
|
| 1138 |
* ```ts
|
| 1139 |
-
* import
|
| 1140 |
-
* import * as Option from "effect/Option"
|
| 1141 |
*
|
| 1142 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1143 |
*
|
|
@@ -1149,22 +1246,23 @@ export declare const modifyAt: {
|
|
| 1149 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1150 |
* ```
|
| 1151 |
*
|
|
|
|
| 1152 |
* @since 2.0.0
|
| 1153 |
-
* @category transformations
|
| 1154 |
*/
|
| 1155 |
<K, V>(key: K, f: HashMap.UpdateFn<V>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1156 |
/**
|
| 1157 |
-
*
|
| 1158 |
-
* update function. The value of the specified key will be computed using the
|
| 1159 |
-
* provided hash.
|
| 1160 |
*
|
| 1161 |
-
*
|
| 1162 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1163 |
*
|
| 1164 |
-
* @example
|
| 1165 |
* ```ts
|
| 1166 |
-
* import
|
| 1167 |
-
* import * as Option from "effect/Option"
|
| 1168 |
*
|
| 1169 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1170 |
*
|
|
@@ -1176,26 +1274,25 @@ export declare const modifyAt: {
|
|
| 1176 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1177 |
* ```
|
| 1178 |
*
|
|
|
|
| 1179 |
* @since 2.0.0
|
| 1180 |
-
* @category transformations
|
| 1181 |
*/
|
| 1182 |
<K, V>(self: HashMap<K, V>, key: K, f: HashMap.UpdateFn<V>): HashMap<K, V>;
|
| 1183 |
};
|
| 1184 |
/**
|
| 1185 |
-
*
|
| 1186 |
-
*
|
| 1187 |
-
*
|
|
|
|
| 1188 |
*
|
| 1189 |
-
* The update function
|
| 1190 |
-
*
|
|
|
|
| 1191 |
*
|
| 1192 |
-
*
|
| 1193 |
*
|
| 1194 |
-
* @example
|
| 1195 |
* ```ts
|
| 1196 |
-
* import { Hash } from "effect"
|
| 1197 |
-
* import * as HashMap from "effect/HashMap"
|
| 1198 |
-
* import * as Option from "effect/Option"
|
| 1199 |
*
|
| 1200 |
* // Useful when working with precomputed hashes for performance
|
| 1201 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
@@ -1229,25 +1326,24 @@ export declare const modifyAt: {
|
|
| 1229 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1230 |
* ```
|
| 1231 |
*
|
|
|
|
| 1232 |
* @since 2.0.0
|
| 1233 |
-
* @category transformations
|
| 1234 |
*/
|
| 1235 |
export declare const modifyHash: {
|
| 1236 |
/**
|
| 1237 |
-
*
|
| 1238 |
-
*
|
| 1239 |
-
*
|
|
|
|
| 1240 |
*
|
| 1241 |
-
* The update function
|
| 1242 |
-
*
|
|
|
|
| 1243 |
*
|
| 1244 |
-
*
|
| 1245 |
*
|
| 1246 |
-
* @example
|
| 1247 |
* ```ts
|
| 1248 |
-
* import { Hash } from "effect"
|
| 1249 |
-
* import * as HashMap from "effect/HashMap"
|
| 1250 |
-
* import * as Option from "effect/Option"
|
| 1251 |
*
|
| 1252 |
* // Useful when working with precomputed hashes for performance
|
| 1253 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
@@ -1281,25 +1377,24 @@ export declare const modifyHash: {
|
|
| 1281 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1282 |
* ```
|
| 1283 |
*
|
|
|
|
| 1284 |
* @since 2.0.0
|
| 1285 |
-
* @category transformations
|
| 1286 |
*/
|
| 1287 |
<K, V>(key: K, hash: number, f: HashMap.UpdateFn<V>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1288 |
/**
|
| 1289 |
-
*
|
| 1290 |
-
*
|
| 1291 |
-
* provided hash.
|
| 1292 |
*
|
| 1293 |
-
*
|
| 1294 |
-
* exists, or `None` if no such value exists.
|
| 1295 |
*
|
| 1296 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1297 |
*
|
| 1298 |
-
* @example
|
| 1299 |
* ```ts
|
| 1300 |
-
* import { Hash } from "effect"
|
| 1301 |
-
* import * as HashMap from "effect/HashMap"
|
| 1302 |
-
* import * as Option from "effect/Option"
|
| 1303 |
*
|
| 1304 |
* // Useful when working with precomputed hashes for performance
|
| 1305 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
@@ -1333,17 +1428,18 @@ export declare const modifyHash: {
|
|
| 1333 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1334 |
* ```
|
| 1335 |
*
|
|
|
|
| 1336 |
* @since 2.0.0
|
| 1337 |
-
* @category transformations
|
| 1338 |
*/
|
| 1339 |
<K, V>(self: HashMap<K, V>, key: K, hash: number, f: HashMap.UpdateFn<V>): HashMap<K, V>;
|
| 1340 |
};
|
| 1341 |
/**
|
| 1342 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1343 |
*
|
| 1344 |
-
*
|
|
|
|
| 1345 |
* ```ts
|
| 1346 |
-
* import
|
| 1347 |
*
|
| 1348 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1349 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
@@ -1352,16 +1448,17 @@ export declare const modifyHash: {
|
|
| 1352 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1353 |
* ```
|
| 1354 |
*
|
|
|
|
| 1355 |
* @since 2.0.0
|
| 1356 |
-
* @category transformations
|
| 1357 |
*/
|
| 1358 |
export declare const modify: {
|
| 1359 |
/**
|
| 1360 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1361 |
*
|
| 1362 |
-
*
|
|
|
|
| 1363 |
* ```ts
|
| 1364 |
-
* import
|
| 1365 |
*
|
| 1366 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1367 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
@@ -1370,16 +1467,17 @@ export declare const modify: {
|
|
| 1370 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1371 |
* ```
|
| 1372 |
*
|
|
|
|
| 1373 |
* @since 2.0.0
|
| 1374 |
-
* @category transformations
|
| 1375 |
*/
|
| 1376 |
<K, V>(key: K, f: (v: V) => V): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1377 |
/**
|
| 1378 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1379 |
*
|
| 1380 |
-
*
|
|
|
|
| 1381 |
* ```ts
|
| 1382 |
-
* import
|
| 1383 |
*
|
| 1384 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1385 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
@@ -1388,17 +1486,23 @@ export declare const modify: {
|
|
| 1388 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1389 |
* ```
|
| 1390 |
*
|
|
|
|
| 1391 |
* @since 2.0.0
|
| 1392 |
-
* @category transformations
|
| 1393 |
*/
|
| 1394 |
<K, V>(self: HashMap<K, V>, key: K, f: (v: V) => V): HashMap<K, V>;
|
| 1395 |
};
|
| 1396 |
/**
|
| 1397 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1398 |
*
|
| 1399 |
-
* @example
|
| 1400 |
* ```ts
|
| 1401 |
-
* import
|
| 1402 |
*
|
| 1403 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1404 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
@@ -1408,16 +1512,22 @@ export declare const modify: {
|
|
| 1408 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1409 |
* ```
|
| 1410 |
*
|
| 1411 |
-
* @since 2.0.0
|
| 1412 |
* @category combining
|
|
|
|
| 1413 |
*/
|
| 1414 |
export declare const union: {
|
| 1415 |
/**
|
| 1416 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1417 |
*
|
| 1418 |
-
* @example
|
| 1419 |
* ```ts
|
| 1420 |
-
* import
|
| 1421 |
*
|
| 1422 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1423 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
@@ -1427,16 +1537,22 @@ export declare const union: {
|
|
| 1427 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1428 |
* ```
|
| 1429 |
*
|
| 1430 |
-
* @since 2.0.0
|
| 1431 |
* @category combining
|
|
|
|
| 1432 |
*/
|
| 1433 |
<K1, V1>(that: HashMap<K1, V1>): <K0, V0>(self: HashMap<K0, V0>) => HashMap<K1 | K0, V1 | V0>;
|
| 1434 |
/**
|
| 1435 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1436 |
*
|
| 1437 |
-
* @example
|
| 1438 |
* ```ts
|
| 1439 |
-
* import
|
| 1440 |
*
|
| 1441 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1442 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
@@ -1446,18 +1562,19 @@ export declare const union: {
|
|
| 1446 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1447 |
* ```
|
| 1448 |
*
|
| 1449 |
-
* @since 2.0.0
|
| 1450 |
* @category combining
|
|
|
|
| 1451 |
*/
|
| 1452 |
<K0, V0, K1, V1>(self: HashMap<K0, V0>, that: HashMap<K1, V1>): HashMap<K0 | K1, V0 | V1>;
|
| 1453 |
};
|
| 1454 |
/**
|
| 1455 |
-
*
|
| 1456 |
* hashing function.
|
| 1457 |
*
|
| 1458 |
-
*
|
|
|
|
| 1459 |
* ```ts
|
| 1460 |
-
* import
|
| 1461 |
*
|
| 1462 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1463 |
* const map2 = HashMap.remove(map1, "b")
|
|
@@ -1467,17 +1584,18 @@ export declare const union: {
|
|
| 1467 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1468 |
* ```
|
| 1469 |
*
|
|
|
|
| 1470 |
* @since 2.0.0
|
| 1471 |
-
* @category transformations
|
| 1472 |
*/
|
| 1473 |
export declare const remove: {
|
| 1474 |
/**
|
| 1475 |
-
*
|
| 1476 |
* hashing function.
|
| 1477 |
*
|
| 1478 |
-
*
|
|
|
|
| 1479 |
* ```ts
|
| 1480 |
-
* import
|
| 1481 |
*
|
| 1482 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1483 |
* const map2 = HashMap.remove(map1, "b")
|
|
@@ -1487,17 +1605,18 @@ export declare const remove: {
|
|
| 1487 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1488 |
* ```
|
| 1489 |
*
|
|
|
|
| 1490 |
* @since 2.0.0
|
| 1491 |
-
* @category transformations
|
| 1492 |
*/
|
| 1493 |
<K>(key: K): <V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1494 |
/**
|
| 1495 |
-
*
|
| 1496 |
* hashing function.
|
| 1497 |
*
|
| 1498 |
-
*
|
|
|
|
| 1499 |
* ```ts
|
| 1500 |
-
* import
|
| 1501 |
*
|
| 1502 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1503 |
* const map2 = HashMap.remove(map1, "b")
|
|
@@ -1507,17 +1626,18 @@ export declare const remove: {
|
|
| 1507 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1508 |
* ```
|
| 1509 |
*
|
|
|
|
| 1510 |
* @since 2.0.0
|
| 1511 |
-
* @category transformations
|
| 1512 |
*/
|
| 1513 |
<K, V>(self: HashMap<K, V>, key: K): HashMap<K, V>;
|
| 1514 |
};
|
| 1515 |
/**
|
| 1516 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1517 |
*
|
| 1518 |
-
*
|
|
|
|
| 1519 |
* ```ts
|
| 1520 |
-
* import
|
| 1521 |
*
|
| 1522 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1523 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
@@ -1527,16 +1647,17 @@ export declare const remove: {
|
|
| 1527 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1528 |
* ```
|
| 1529 |
*
|
|
|
|
| 1530 |
* @since 2.0.0
|
| 1531 |
-
* @category transformations
|
| 1532 |
*/
|
| 1533 |
export declare const removeMany: {
|
| 1534 |
/**
|
| 1535 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1536 |
*
|
| 1537 |
-
*
|
|
|
|
| 1538 |
* ```ts
|
| 1539 |
-
* import
|
| 1540 |
*
|
| 1541 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1542 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
@@ -1546,16 +1667,17 @@ export declare const removeMany: {
|
|
| 1546 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1547 |
* ```
|
| 1548 |
*
|
|
|
|
| 1549 |
* @since 2.0.0
|
| 1550 |
-
* @category transformations
|
| 1551 |
*/
|
| 1552 |
<K>(keys: Iterable<K>): <V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1553 |
/**
|
| 1554 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1555 |
*
|
| 1556 |
-
*
|
|
|
|
| 1557 |
* ```ts
|
| 1558 |
-
* import
|
| 1559 |
*
|
| 1560 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1561 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
@@ -1565,17 +1687,18 @@ export declare const removeMany: {
|
|
| 1565 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1566 |
* ```
|
| 1567 |
*
|
|
|
|
| 1568 |
* @since 2.0.0
|
| 1569 |
-
* @category transformations
|
| 1570 |
*/
|
| 1571 |
<K, V>(self: HashMap<K, V>, keys: Iterable<K>): HashMap<K, V>;
|
| 1572 |
};
|
| 1573 |
/**
|
| 1574 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1575 |
*
|
| 1576 |
-
*
|
|
|
|
| 1577 |
* ```ts
|
| 1578 |
-
* import
|
| 1579 |
*
|
| 1580 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1581 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
@@ -1586,16 +1709,17 @@ export declare const removeMany: {
|
|
| 1586 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1587 |
* ```
|
| 1588 |
*
|
| 1589 |
-
* @
|
| 1590 |
-
* @
|
| 1591 |
*/
|
| 1592 |
export declare const setMany: {
|
| 1593 |
/**
|
| 1594 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1595 |
*
|
| 1596 |
-
*
|
|
|
|
| 1597 |
* ```ts
|
| 1598 |
-
* import
|
| 1599 |
*
|
| 1600 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1601 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
@@ -1606,16 +1730,17 @@ export declare const setMany: {
|
|
| 1606 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1607 |
* ```
|
| 1608 |
*
|
| 1609 |
-
* @
|
| 1610 |
-
* @
|
| 1611 |
*/
|
| 1612 |
<K, V>(entries: Iterable<readonly [K, V]>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1613 |
/**
|
| 1614 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1615 |
*
|
| 1616 |
-
*
|
|
|
|
| 1617 |
* ```ts
|
| 1618 |
-
* import
|
| 1619 |
*
|
| 1620 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1621 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
@@ -1626,17 +1751,18 @@ export declare const setMany: {
|
|
| 1626 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1627 |
* ```
|
| 1628 |
*
|
| 1629 |
-
* @
|
| 1630 |
-
* @
|
| 1631 |
*/
|
| 1632 |
<K, V>(self: HashMap<K, V>, entries: Iterable<readonly [K, V]>): HashMap<K, V>;
|
| 1633 |
};
|
| 1634 |
/**
|
| 1635 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1636 |
*
|
| 1637 |
-
*
|
|
|
|
| 1638 |
* ```ts
|
| 1639 |
-
* import
|
| 1640 |
*
|
| 1641 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1642 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
@@ -1645,16 +1771,17 @@ export declare const setMany: {
|
|
| 1645 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1646 |
* ```
|
| 1647 |
*
|
| 1648 |
-
* @since 2.0.0
|
| 1649 |
* @category mapping
|
|
|
|
| 1650 |
*/
|
| 1651 |
export declare const map: {
|
| 1652 |
/**
|
| 1653 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1654 |
*
|
| 1655 |
-
*
|
|
|
|
| 1656 |
* ```ts
|
| 1657 |
-
* import
|
| 1658 |
*
|
| 1659 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1660 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
@@ -1663,16 +1790,17 @@ export declare const map: {
|
|
| 1663 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1664 |
* ```
|
| 1665 |
*
|
| 1666 |
-
* @since 2.0.0
|
| 1667 |
* @category mapping
|
|
|
|
| 1668 |
*/
|
| 1669 |
<A, V, K>(f: (value: V, key: K) => A): (self: HashMap<K, V>) => HashMap<K, A>;
|
| 1670 |
/**
|
| 1671 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1672 |
*
|
| 1673 |
-
*
|
|
|
|
| 1674 |
* ```ts
|
| 1675 |
-
* import
|
| 1676 |
*
|
| 1677 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1678 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
@@ -1681,19 +1809,22 @@ export declare const map: {
|
|
| 1681 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1682 |
* ```
|
| 1683 |
*
|
| 1684 |
-
* @since 2.0.0
|
| 1685 |
* @category mapping
|
|
|
|
| 1686 |
*/
|
| 1687 |
<K, V, A>(self: HashMap<K, V>, f: (value: V, key: K) => A): HashMap<K, A>;
|
| 1688 |
};
|
| 1689 |
/**
|
| 1690 |
-
*
|
| 1691 |
*
|
| 1692 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1693 |
*
|
| 1694 |
-
* @example
|
| 1695 |
* ```ts
|
| 1696 |
-
* import
|
| 1697 |
*
|
| 1698 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1699 |
* const map2 = HashMap.flatMap(
|
|
@@ -1706,18 +1837,21 @@ export declare const map: {
|
|
| 1706 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1707 |
* ```
|
| 1708 |
*
|
| 1709 |
-
* @since 2.0.0
|
| 1710 |
* @category sequencing
|
|
|
|
| 1711 |
*/
|
| 1712 |
export declare const flatMap: {
|
| 1713 |
/**
|
| 1714 |
-
*
|
| 1715 |
*
|
| 1716 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1717 |
*
|
| 1718 |
-
* @example
|
| 1719 |
* ```ts
|
| 1720 |
-
* import
|
| 1721 |
*
|
| 1722 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1723 |
* const map2 = HashMap.flatMap(
|
|
@@ -1730,18 +1864,21 @@ export declare const flatMap: {
|
|
| 1730 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1731 |
* ```
|
| 1732 |
*
|
| 1733 |
-
* @since 2.0.0
|
| 1734 |
* @category sequencing
|
|
|
|
| 1735 |
*/
|
| 1736 |
<A, K, B>(f: (value: A, key: K) => HashMap<K, B>): (self: HashMap<K, A>) => HashMap<K, B>;
|
| 1737 |
/**
|
| 1738 |
-
*
|
| 1739 |
*
|
| 1740 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1741 |
*
|
| 1742 |
-
* @example
|
| 1743 |
* ```ts
|
| 1744 |
-
* import
|
| 1745 |
*
|
| 1746 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1747 |
* const map2 = HashMap.flatMap(
|
|
@@ -1754,17 +1891,18 @@ export declare const flatMap: {
|
|
| 1754 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1755 |
* ```
|
| 1756 |
*
|
| 1757 |
-
* @since 2.0.0
|
| 1758 |
* @category sequencing
|
|
|
|
| 1759 |
*/
|
| 1760 |
<K, A, B>(self: HashMap<K, A>, f: (value: A, key: K) => HashMap<K, B>): HashMap<K, B>;
|
| 1761 |
};
|
| 1762 |
/**
|
| 1763 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1764 |
*
|
| 1765 |
-
*
|
|
|
|
| 1766 |
* ```ts
|
| 1767 |
-
* import
|
| 1768 |
*
|
| 1769 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1770 |
* const collected: Array<[string, number]> = []
|
|
@@ -1776,16 +1914,17 @@ export declare const flatMap: {
|
|
| 1776 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1777 |
* ```
|
| 1778 |
*
|
| 1779 |
-
* @since 2.0.0
|
| 1780 |
* @category traversing
|
|
|
|
| 1781 |
*/
|
| 1782 |
export declare const forEach: {
|
| 1783 |
/**
|
| 1784 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1785 |
*
|
| 1786 |
-
*
|
|
|
|
| 1787 |
* ```ts
|
| 1788 |
-
* import
|
| 1789 |
*
|
| 1790 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1791 |
* const collected: Array<[string, number]> = []
|
|
@@ -1797,16 +1936,17 @@ export declare const forEach: {
|
|
| 1797 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1798 |
* ```
|
| 1799 |
*
|
| 1800 |
-
* @since 2.0.0
|
| 1801 |
* @category traversing
|
|
|
|
| 1802 |
*/
|
| 1803 |
<V, K>(f: (value: V, key: K) => void): (self: HashMap<K, V>) => void;
|
| 1804 |
/**
|
| 1805 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1806 |
*
|
| 1807 |
-
*
|
|
|
|
| 1808 |
* ```ts
|
| 1809 |
-
* import
|
| 1810 |
*
|
| 1811 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1812 |
* const collected: Array<[string, number]> = []
|
|
@@ -1818,17 +1958,18 @@ export declare const forEach: {
|
|
| 1818 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1819 |
* ```
|
| 1820 |
*
|
| 1821 |
-
* @since 2.0.0
|
| 1822 |
* @category traversing
|
|
|
|
| 1823 |
*/
|
| 1824 |
<V, K>(self: HashMap<K, V>, f: (value: V, key: K) => void): void;
|
| 1825 |
};
|
| 1826 |
/**
|
| 1827 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 1828 |
*
|
| 1829 |
-
*
|
|
|
|
| 1830 |
* ```ts
|
| 1831 |
-
* import
|
| 1832 |
*
|
| 1833 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1834 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
@@ -1836,16 +1977,17 @@ export declare const forEach: {
|
|
| 1836 |
* console.log(sum) // 6
|
| 1837 |
* ```
|
| 1838 |
*
|
| 1839 |
-
* @since 2.0.0
|
| 1840 |
* @category folding
|
|
|
|
| 1841 |
*/
|
| 1842 |
export declare const reduce: {
|
| 1843 |
/**
|
| 1844 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 1845 |
*
|
| 1846 |
-
*
|
|
|
|
| 1847 |
* ```ts
|
| 1848 |
-
* import
|
| 1849 |
*
|
| 1850 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1851 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
@@ -1853,16 +1995,17 @@ export declare const reduce: {
|
|
| 1853 |
* console.log(sum) // 6
|
| 1854 |
* ```
|
| 1855 |
*
|
| 1856 |
-
* @since 2.0.0
|
| 1857 |
* @category folding
|
|
|
|
| 1858 |
*/
|
| 1859 |
<Z, V, K>(zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: HashMap<K, V>) => Z;
|
| 1860 |
/**
|
| 1861 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 1862 |
*
|
| 1863 |
-
*
|
|
|
|
| 1864 |
* ```ts
|
| 1865 |
-
* import
|
| 1866 |
*
|
| 1867 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1868 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
@@ -1870,17 +2013,18 @@ export declare const reduce: {
|
|
| 1870 |
* console.log(sum) // 6
|
| 1871 |
* ```
|
| 1872 |
*
|
| 1873 |
-
* @since 2.0.0
|
| 1874 |
* @category folding
|
|
|
|
| 1875 |
*/
|
| 1876 |
<K, V, Z>(self: HashMap<K, V>, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z;
|
| 1877 |
};
|
| 1878 |
/**
|
| 1879 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 1880 |
*
|
| 1881 |
-
*
|
|
|
|
| 1882 |
* ```ts
|
| 1883 |
-
* import
|
| 1884 |
*
|
| 1885 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1886 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
@@ -1891,16 +2035,17 @@ export declare const reduce: {
|
|
| 1891 |
* console.log(HashMap.has(map2, "a")) // false
|
| 1892 |
* ```
|
| 1893 |
*
|
| 1894 |
-
* @since 2.0.0
|
| 1895 |
* @category filtering
|
|
|
|
| 1896 |
*/
|
| 1897 |
export declare const filter: {
|
| 1898 |
/**
|
| 1899 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 1900 |
*
|
| 1901 |
-
*
|
|
|
|
| 1902 |
* ```ts
|
| 1903 |
-
* import
|
| 1904 |
*
|
| 1905 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1906 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
@@ -1911,16 +2056,17 @@ export declare const filter: {
|
|
| 1911 |
* console.log(HashMap.has(map2, "a")) // false
|
| 1912 |
* ```
|
| 1913 |
*
|
| 1914 |
-
* @since 2.0.0
|
| 1915 |
* @category filtering
|
|
|
|
| 1916 |
*/
|
| 1917 |
<K, A>(f: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => HashMap<K, A>;
|
| 1918 |
/**
|
| 1919 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 1920 |
*
|
| 1921 |
-
*
|
|
|
|
| 1922 |
* ```ts
|
| 1923 |
-
* import
|
| 1924 |
*
|
| 1925 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1926 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
@@ -1931,18 +2077,18 @@ export declare const filter: {
|
|
| 1931 |
* console.log(HashMap.has(map2, "a")) // false
|
| 1932 |
* ```
|
| 1933 |
*
|
| 1934 |
-
* @since 2.0.0
|
| 1935 |
* @category filtering
|
|
|
|
| 1936 |
*/
|
| 1937 |
<K, A>(self: HashMap<K, A>, f: (a: A, k: K) => boolean): HashMap<K, A>;
|
| 1938 |
};
|
| 1939 |
/**
|
| 1940 |
* Filters out `None` values from a `HashMap` of `Options`s.
|
| 1941 |
*
|
| 1942 |
-
*
|
|
|
|
| 1943 |
* ```ts
|
| 1944 |
-
* import
|
| 1945 |
-
* import * as Option from "effect/Option"
|
| 1946 |
*
|
| 1947 |
* const map1 = HashMap.make(
|
| 1948 |
* ["a", Option.some(1)],
|
|
@@ -1956,18 +2102,18 @@ export declare const filter: {
|
|
| 1956 |
* console.log(HashMap.has(map2, "b")) // false
|
| 1957 |
* ```
|
| 1958 |
*
|
| 1959 |
-
* @since 2.0.0
|
| 1960 |
* @category filtering
|
|
|
|
| 1961 |
*/
|
| 1962 |
export declare const compact: <K, A>(self: HashMap<K, Option<A>>) => HashMap<K, A>;
|
| 1963 |
/**
|
| 1964 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 1965 |
* only successful results.
|
| 1966 |
*
|
| 1967 |
-
*
|
|
|
|
| 1968 |
* ```ts
|
| 1969 |
-
* import
|
| 1970 |
-
* import * as Result from "effect/Result"
|
| 1971 |
*
|
| 1972 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1973 |
* const map2 = HashMap.filterMap(
|
|
@@ -1980,18 +2126,18 @@ export declare const compact: <K, A>(self: HashMap<K, Option<A>>) => HashMap<K,
|
|
| 1980 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 1981 |
* ```
|
| 1982 |
*
|
| 1983 |
-
* @since 2.0.0
|
| 1984 |
* @category filtering
|
|
|
|
| 1985 |
*/
|
| 1986 |
export declare const filterMap: {
|
| 1987 |
/**
|
| 1988 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 1989 |
* only successful results.
|
| 1990 |
*
|
| 1991 |
-
*
|
|
|
|
| 1992 |
* ```ts
|
| 1993 |
-
* import
|
| 1994 |
-
* import * as Result from "effect/Result"
|
| 1995 |
*
|
| 1996 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1997 |
* const map2 = HashMap.filterMap(
|
|
@@ -2004,18 +2150,18 @@ export declare const filterMap: {
|
|
| 2004 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 2005 |
* ```
|
| 2006 |
*
|
| 2007 |
-
* @since 2.0.0
|
| 2008 |
* @category filtering
|
|
|
|
| 2009 |
*/
|
| 2010 |
<A, K, B, X>(f: (input: A, key: K) => Result<B, X>): (self: HashMap<K, A>) => HashMap<K, B>;
|
| 2011 |
/**
|
| 2012 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 2013 |
* only successful results.
|
| 2014 |
*
|
| 2015 |
-
*
|
|
|
|
| 2016 |
* ```ts
|
| 2017 |
-
* import
|
| 2018 |
-
* import * as Result from "effect/Result"
|
| 2019 |
*
|
| 2020 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2021 |
* const map2 = HashMap.filterMap(
|
|
@@ -2028,8 +2174,8 @@ export declare const filterMap: {
|
|
| 2028 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 2029 |
* ```
|
| 2030 |
*
|
| 2031 |
-
* @since 2.0.0
|
| 2032 |
* @category filtering
|
|
|
|
| 2033 |
*/
|
| 2034 |
<K, A, B, X>(self: HashMap<K, A>, f: (input: A, key: K) => Result<B, X>): HashMap<K, B>;
|
| 2035 |
};
|
|
@@ -2037,15 +2183,15 @@ export declare const filterMap: {
|
|
| 2037 |
* Returns the first element that satisfies the specified
|
| 2038 |
* predicate, or `None` if no such element exists.
|
| 2039 |
*
|
| 2040 |
-
*
|
|
|
|
| 2041 |
* ```ts
|
| 2042 |
-
* import
|
| 2043 |
-
* import * as Option from "effect/Option"
|
| 2044 |
*
|
| 2045 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2046 |
-
* const result = HashMap.findFirst(map, (value) => value > 1)
|
| 2047 |
-
* console.log(result) // Option.some(["
|
| 2048 |
-
* console.log(Option.getOrElse(result, () => ["", 0])) // ["
|
| 2049 |
* ```
|
| 2050 |
*
|
| 2051 |
* @category elements
|
|
@@ -2056,15 +2202,15 @@ export declare const findFirst: {
|
|
| 2056 |
* Returns the first element that satisfies the specified
|
| 2057 |
* predicate, or `None` if no such element exists.
|
| 2058 |
*
|
| 2059 |
-
*
|
|
|
|
| 2060 |
* ```ts
|
| 2061 |
-
* import
|
| 2062 |
-
* import * as Option from "effect/Option"
|
| 2063 |
*
|
| 2064 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2065 |
-
* const result = HashMap.findFirst(map, (value) => value > 1)
|
| 2066 |
-
* console.log(result) // Option.some(["
|
| 2067 |
-
* console.log(Option.getOrElse(result, () => ["", 0])) // ["
|
| 2068 |
* ```
|
| 2069 |
*
|
| 2070 |
* @category elements
|
|
@@ -2075,15 +2221,15 @@ export declare const findFirst: {
|
|
| 2075 |
* Returns the first element that satisfies the specified
|
| 2076 |
* predicate, or `None` if no such element exists.
|
| 2077 |
*
|
| 2078 |
-
*
|
|
|
|
| 2079 |
* ```ts
|
| 2080 |
-
* import
|
| 2081 |
-
* import * as Option from "effect/Option"
|
| 2082 |
*
|
| 2083 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2084 |
-
* const result = HashMap.findFirst(map, (value) => value > 1)
|
| 2085 |
-
* console.log(result) // Option.some(["
|
| 2086 |
-
* console.log(Option.getOrElse(result, () => ["", 0])) // ["
|
| 2087 |
* ```
|
| 2088 |
*
|
| 2089 |
* @category elements
|
|
@@ -2092,11 +2238,12 @@ export declare const findFirst: {
|
|
| 2092 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): Option<[K, A]>;
|
| 2093 |
};
|
| 2094 |
/**
|
| 2095 |
-
* Checks
|
|
|
|
|
|
|
| 2096 |
*
|
| 2097 |
-
* @example
|
| 2098 |
* ```ts
|
| 2099 |
-
* import
|
| 2100 |
*
|
| 2101 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2102 |
*
|
|
@@ -2104,16 +2251,17 @@ export declare const findFirst: {
|
|
| 2104 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2105 |
* ```
|
| 2106 |
*
|
| 2107 |
-
* @since 3.13.0
|
| 2108 |
* @category elements
|
|
|
|
| 2109 |
*/
|
| 2110 |
export declare const some: {
|
| 2111 |
/**
|
| 2112 |
-
* Checks
|
|
|
|
|
|
|
| 2113 |
*
|
| 2114 |
-
* @example
|
| 2115 |
* ```ts
|
| 2116 |
-
* import
|
| 2117 |
*
|
| 2118 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2119 |
*
|
|
@@ -2121,16 +2269,17 @@ export declare const some: {
|
|
| 2121 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2122 |
* ```
|
| 2123 |
*
|
| 2124 |
-
* @since 3.13.0
|
| 2125 |
* @category elements
|
|
|
|
| 2126 |
*/
|
| 2127 |
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => boolean;
|
| 2128 |
/**
|
| 2129 |
-
* Checks
|
|
|
|
|
|
|
| 2130 |
*
|
| 2131 |
-
* @example
|
| 2132 |
* ```ts
|
| 2133 |
-
* import
|
| 2134 |
*
|
| 2135 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2136 |
*
|
|
@@ -2138,17 +2287,18 @@ export declare const some: {
|
|
| 2138 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2139 |
* ```
|
| 2140 |
*
|
| 2141 |
-
* @since 3.13.0
|
| 2142 |
* @category elements
|
|
|
|
| 2143 |
*/
|
| 2144 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): boolean;
|
| 2145 |
};
|
| 2146 |
/**
|
| 2147 |
-
* Checks
|
|
|
|
|
|
|
| 2148 |
*
|
| 2149 |
-
* @example
|
| 2150 |
* ```ts
|
| 2151 |
-
* import
|
| 2152 |
*
|
| 2153 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2154 |
*
|
|
@@ -2156,19 +2306,17 @@ export declare const some: {
|
|
| 2156 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2157 |
* ```
|
| 2158 |
*
|
| 2159 |
-
* @param self - The hashmap to check.
|
| 2160 |
-
* @param predicate - The condition to test entries (value, key).
|
| 2161 |
-
*
|
| 2162 |
-
* @since 3.14.0
|
| 2163 |
* @category elements
|
|
|
|
| 2164 |
*/
|
| 2165 |
export declare const every: {
|
| 2166 |
/**
|
| 2167 |
-
* Checks
|
|
|
|
|
|
|
| 2168 |
*
|
| 2169 |
-
* @example
|
| 2170 |
* ```ts
|
| 2171 |
-
* import
|
| 2172 |
*
|
| 2173 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2174 |
*
|
|
@@ -2176,19 +2324,17 @@ export declare const every: {
|
|
| 2176 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2177 |
* ```
|
| 2178 |
*
|
| 2179 |
-
* @param self - The hashmap to check.
|
| 2180 |
-
* @param predicate - The condition to test entries (value, key).
|
| 2181 |
-
*
|
| 2182 |
-
* @since 3.14.0
|
| 2183 |
* @category elements
|
|
|
|
| 2184 |
*/
|
| 2185 |
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => boolean;
|
| 2186 |
/**
|
| 2187 |
-
* Checks
|
|
|
|
|
|
|
| 2188 |
*
|
| 2189 |
-
* @example
|
| 2190 |
* ```ts
|
| 2191 |
-
* import
|
| 2192 |
*
|
| 2193 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2194 |
*
|
|
@@ -2196,11 +2342,8 @@ export declare const every: {
|
|
| 2196 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2197 |
* ```
|
| 2198 |
*
|
| 2199 |
-
* @param self - The hashmap to check.
|
| 2200 |
-
* @param predicate - The condition to test entries (value, key).
|
| 2201 |
-
*
|
| 2202 |
-
* @since 3.14.0
|
| 2203 |
* @category elements
|
|
|
|
| 2204 |
*/
|
| 2205 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): boolean;
|
| 2206 |
};
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Stores key/value entries in an immutable hash map.
|
| 3 |
+
*
|
| 4 |
+
* A `HashMap<Key, Value>` hashes keys and resolves matches with Effect's
|
| 5 |
+
* structural equality rules. Lookup, insertion, removal, and transformation
|
| 6 |
+
* operations return new maps, while temporary mutation helpers support efficient
|
| 7 |
+
* batch updates. This module also includes constructors, iteration, conversion,
|
| 8 |
+
* mapping, filtering, and reducing helpers.
|
| 9 |
+
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
| 12 |
import type { Equal } from "./Equal.ts";
|
|
|
|
| 21 |
* insertion, and deletion operations. It uses a Hash Array Mapped Trie (HAMT) internally
|
| 22 |
* for structural sharing and optimal performance.
|
| 23 |
*
|
| 24 |
+
* **Example** (Using basic HashMap operations)
|
| 25 |
+
*
|
| 26 |
* ```ts
|
| 27 |
+
* import { HashMap } from "effect"
|
| 28 |
*
|
| 29 |
* // Create a HashMap
|
| 30 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
|
|
| 41 |
* console.log(HashMap.size(updated)) // 4
|
| 42 |
* ```
|
| 43 |
*
|
|
|
|
| 44 |
* @category models
|
| 45 |
+
* @since 2.0.0
|
| 46 |
*/
|
| 47 |
export interface HashMap<out Key, out Value> extends Iterable<[Key, Value]>, Equal, Pipeable, Inspectable {
|
| 48 |
readonly [TypeId]: typeof TypeId;
|
|
|
|
| 51 |
* The HashMap namespace contains type-level utilities and helper types
|
| 52 |
* for working with HashMap instances.
|
| 53 |
*
|
| 54 |
+
* **Example** (Extracting HashMap types)
|
| 55 |
+
*
|
| 56 |
* ```ts
|
| 57 |
+
* import { HashMap } from "effect"
|
| 58 |
*
|
| 59 |
* // Create a concrete HashMap for type extraction
|
| 60 |
* const inventory = HashMap.make(
|
|
|
|
| 80 |
* ```
|
| 81 |
*
|
| 82 |
* @since 2.0.0
|
|
|
|
| 83 |
*/
|
| 84 |
export declare namespace HashMap {
|
| 85 |
/**
|
|
|
|
| 87 |
* Takes an Option representing the current value and returns an Option
|
| 88 |
* representing the new value.
|
| 89 |
*
|
| 90 |
+
* **Example** (Updating values from Options)
|
| 91 |
+
*
|
| 92 |
* ```ts
|
| 93 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 94 |
*
|
| 95 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 96 |
*
|
|
|
|
| 102 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 103 |
* ```
|
| 104 |
*
|
|
|
|
| 105 |
* @category models
|
| 106 |
+
* @since 2.0.0
|
| 107 |
*/
|
| 108 |
type UpdateFn<V> = (option: Option<V>) => Option<V>;
|
| 109 |
/**
|
| 110 |
* This type-level utility extracts the key type `K` from a `HashMap<K, V>` type.
|
| 111 |
*
|
| 112 |
+
* **Example** (Extracting key types)
|
| 113 |
+
*
|
| 114 |
* ```ts
|
| 115 |
+
* import { HashMap } from "effect"
|
| 116 |
*
|
| 117 |
* // Create a HashMap to extract key type from
|
| 118 |
* const userMap = HashMap.make(
|
|
|
|
| 127 |
* const getUserById = (id: UserKey) => HashMap.get(userMap, id)
|
| 128 |
* console.log(getUserById("alice")) // Option.some({ name: "Alice", age: 30 })
|
| 129 |
* ```
|
| 130 |
+
*
|
| 131 |
+
* @category utility types
|
| 132 |
* @since 2.0.0
|
|
|
|
| 133 |
*/
|
| 134 |
type Key<T extends HashMap<any, any>> = [T] extends [HashMap<infer _K, infer _V>] ? _K : never;
|
| 135 |
/**
|
| 136 |
* This type-level utility extracts the value type `V` from a `HashMap<K, V>` type.
|
| 137 |
*
|
| 138 |
+
* **Example** (Extracting value types)
|
| 139 |
+
*
|
| 140 |
* ```ts
|
| 141 |
+
* import { HashMap } from "effect"
|
| 142 |
*
|
| 143 |
* // Create a HashMap with user data
|
| 144 |
* const userMap = HashMap.make(
|
|
|
|
| 157 |
* const alice = HashMap.get(userMap, "alice")
|
| 158 |
* // alice has type Option<User> thanks to type extraction
|
| 159 |
* ```
|
| 160 |
+
*
|
| 161 |
+
* @category utility types
|
| 162 |
* @since 2.0.0
|
|
|
|
| 163 |
*/
|
| 164 |
type Value<T extends HashMap<any, any>> = [T] extends [HashMap<infer _K, infer _V>] ? _V : never;
|
| 165 |
/**
|
| 166 |
* This type-level utility extracts the entry type `[K, V]` from a `HashMap<K, V>` type.
|
| 167 |
*
|
| 168 |
+
* **Example** (Extracting entry types)
|
| 169 |
+
*
|
| 170 |
* ```ts
|
| 171 |
+
* import { HashMap } from "effect"
|
| 172 |
*
|
| 173 |
* // Create a product catalog HashMap
|
| 174 |
* const catalog = HashMap.make(
|
|
|
|
| 184 |
* return `${productId}: $${product.price} (${product.category})`
|
| 185 |
* }
|
| 186 |
*
|
| 187 |
+
* // Convert to entries, process, and sort for deterministic output
|
| 188 |
+
* const descriptions = HashMap.toEntries(catalog).map(processEntry).sort()
|
| 189 |
+
* console.log(descriptions) // ["book: $29 (education)", "laptop: $999 (electronics)"]
|
| 190 |
* ```
|
| 191 |
+
*
|
| 192 |
+
* @category utility types
|
| 193 |
* @since 3.9.0
|
|
|
|
| 194 |
*/
|
| 195 |
type Entry<T extends HashMap<any, any>> = [Key<T>, Value<T>];
|
| 196 |
}
|
| 197 |
/**
|
| 198 |
+
* Checks whether a value is a HashMap.
|
| 199 |
+
*
|
| 200 |
+
* **Example** (Checking HashMap values)
|
| 201 |
*
|
|
|
|
| 202 |
* ```ts
|
| 203 |
+
* import { HashMap } from "effect"
|
| 204 |
*
|
| 205 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 206 |
* const notMap = { a: 1 }
|
|
|
|
| 210 |
* console.log(HashMap.isHashMap(null)) // false
|
| 211 |
* ```
|
| 212 |
*
|
|
|
|
| 213 |
* @category refinements
|
| 214 |
+
* @since 2.0.0
|
| 215 |
*/
|
| 216 |
export declare const isHashMap: {
|
| 217 |
/**
|
| 218 |
+
* Checks whether a value is a HashMap.
|
| 219 |
+
*
|
| 220 |
+
* **Example** (Checking HashMap values)
|
| 221 |
*
|
|
|
|
| 222 |
* ```ts
|
| 223 |
+
* import { HashMap } from "effect"
|
| 224 |
*
|
| 225 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 226 |
* const notMap = { a: 1 }
|
|
|
|
| 230 |
* console.log(HashMap.isHashMap(null)) // false
|
| 231 |
* ```
|
| 232 |
*
|
|
|
|
| 233 |
* @category refinements
|
| 234 |
+
* @since 2.0.0
|
| 235 |
*/
|
| 236 |
<K, V>(u: Iterable<readonly [K, V]>): u is HashMap<K, V>;
|
| 237 |
/**
|
| 238 |
+
* Checks whether a value is a HashMap.
|
| 239 |
+
*
|
| 240 |
+
* **Example** (Checking HashMap values)
|
| 241 |
*
|
|
|
|
| 242 |
* ```ts
|
| 243 |
+
* import { HashMap } from "effect"
|
| 244 |
*
|
| 245 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 246 |
* const notMap = { a: 1 }
|
|
|
|
| 250 |
* console.log(HashMap.isHashMap(null)) // false
|
| 251 |
* ```
|
| 252 |
*
|
|
|
|
| 253 |
* @category refinements
|
| 254 |
+
* @since 2.0.0
|
| 255 |
*/
|
| 256 |
(u: unknown): u is HashMap<unknown, unknown>;
|
| 257 |
};
|
| 258 |
/**
|
| 259 |
* Creates a new empty `HashMap`.
|
| 260 |
*
|
| 261 |
+
* **Example** (Creating an empty HashMap)
|
| 262 |
+
*
|
| 263 |
* ```ts
|
| 264 |
+
* import { HashMap } from "effect"
|
| 265 |
*
|
| 266 |
* const map = HashMap.empty<string, number>()
|
| 267 |
* console.log(HashMap.isEmpty(map)) // true
|
| 268 |
* console.log(HashMap.size(map)) // 0
|
| 269 |
* ```
|
| 270 |
*
|
|
|
|
| 271 |
* @category constructors
|
| 272 |
+
* @since 2.0.0
|
| 273 |
*/
|
| 274 |
export declare const empty: <K = never, V = never>() => HashMap<K, V>;
|
| 275 |
/**
|
| 276 |
* Constructs a new `HashMap` from an array of key/value pairs.
|
| 277 |
*
|
| 278 |
+
* **Example** (Creating a HashMap from entries)
|
| 279 |
+
*
|
| 280 |
* ```ts
|
| 281 |
+
* import { HashMap } from "effect"
|
| 282 |
*
|
| 283 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 284 |
* console.log(HashMap.size(map)) // 3
|
| 285 |
* console.log(HashMap.get(map, "b")) // Option.some(2)
|
| 286 |
* ```
|
| 287 |
*
|
|
|
|
| 288 |
* @category constructors
|
| 289 |
+
* @since 2.0.0
|
| 290 |
*/
|
| 291 |
export declare const make: <Entries extends ReadonlyArray<readonly [any, any]>>(...entries: Entries) => HashMap<Entries[number] extends readonly [infer K, any] ? K : never, Entries[number] extends readonly [any, infer V] ? V : never>;
|
| 292 |
/**
|
| 293 |
* Creates a new `HashMap` from an iterable collection of key/value pairs.
|
| 294 |
*
|
| 295 |
+
* **Example** (Creating a HashMap from an iterable)
|
| 296 |
+
*
|
| 297 |
* ```ts
|
| 298 |
+
* import { HashMap } from "effect"
|
| 299 |
*
|
| 300 |
* const entries = [["a", 1], ["b", 2], ["c", 3]] as const
|
| 301 |
* const map = HashMap.fromIterable(entries)
|
|
|
|
| 303 |
* console.log(HashMap.get(map, "a")) // Option.some(1)
|
| 304 |
* ```
|
| 305 |
*
|
|
|
|
| 306 |
* @category constructors
|
| 307 |
+
* @since 2.0.0
|
| 308 |
*/
|
| 309 |
export declare const fromIterable: <K, V>(entries: Iterable<readonly [K, V]>) => HashMap<K, V>;
|
| 310 |
/**
|
| 311 |
+
* Checks whether the `HashMap` contains no entries.
|
| 312 |
+
*
|
| 313 |
+
* **Example** (Checking for empty HashMaps)
|
| 314 |
*
|
|
|
|
| 315 |
* ```ts
|
| 316 |
+
* import { HashMap } from "effect"
|
| 317 |
*
|
| 318 |
* const emptyMap = HashMap.empty<string, number>()
|
| 319 |
* const nonEmptyMap = HashMap.make(["a", 1])
|
|
|
|
| 322 |
* console.log(HashMap.isEmpty(nonEmptyMap)) // false
|
| 323 |
* ```
|
| 324 |
*
|
|
|
|
| 325 |
* @category elements
|
| 326 |
+
* @since 2.0.0
|
| 327 |
*/
|
| 328 |
export declare const isEmpty: <K, V>(self: HashMap<K, V>) => boolean;
|
| 329 |
/**
|
| 330 |
+
* Looks up the value for the specified key in the `HashMap` safely using the
|
| 331 |
* internal hashing function.
|
| 332 |
*
|
| 333 |
+
* **Example** (Looking up values)
|
| 334 |
+
*
|
| 335 |
* ```ts
|
| 336 |
+
* import { HashMap } from "effect"
|
| 337 |
*
|
| 338 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 339 |
*
|
|
|
|
| 345 |
* console.log(value) // Option.some(2)
|
| 346 |
* ```
|
| 347 |
*
|
|
|
|
| 348 |
* @category elements
|
| 349 |
+
* @since 2.0.0
|
| 350 |
*/
|
| 351 |
export declare const get: {
|
| 352 |
/**
|
| 353 |
+
* Looks up the value for the specified key in the `HashMap` safely using the
|
| 354 |
* internal hashing function.
|
| 355 |
*
|
| 356 |
+
* **Example** (Looking up values)
|
| 357 |
+
*
|
| 358 |
* ```ts
|
| 359 |
+
* import { HashMap } from "effect"
|
| 360 |
*
|
| 361 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 362 |
*
|
|
|
|
| 368 |
* console.log(value) // Option.some(2)
|
| 369 |
* ```
|
| 370 |
*
|
|
|
|
| 371 |
* @category elements
|
| 372 |
+
* @since 2.0.0
|
| 373 |
*/
|
| 374 |
<K1 extends K, K>(key: K1): <V>(self: HashMap<K, V>) => Option<V>;
|
| 375 |
/**
|
| 376 |
+
* Looks up the value for the specified key in the `HashMap` safely using the
|
| 377 |
* internal hashing function.
|
| 378 |
*
|
| 379 |
+
* **Example** (Looking up values)
|
| 380 |
+
*
|
| 381 |
* ```ts
|
| 382 |
+
* import { HashMap } from "effect"
|
| 383 |
*
|
| 384 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 385 |
*
|
|
|
|
| 391 |
* console.log(value) // Option.some(2)
|
| 392 |
* ```
|
| 393 |
*
|
|
|
|
| 394 |
* @category elements
|
| 395 |
+
* @since 2.0.0
|
| 396 |
*/
|
| 397 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): Option<V>;
|
| 398 |
};
|
| 399 |
/**
|
| 400 |
+
* Looks up the value for the specified key in the `HashMap` safely using a custom hash.
|
| 401 |
+
*
|
| 402 |
+
* **Example** (Looking up values with a hash)
|
| 403 |
*
|
|
|
|
| 404 |
* ```ts
|
| 405 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 406 |
*
|
| 407 |
* // Useful when implementing custom equality for complex keys
|
| 408 |
* const userMap = HashMap.make(
|
|
|
|
| 423 |
* console.log(notFound) // Option.none()
|
| 424 |
* ```
|
| 425 |
*
|
|
|
|
| 426 |
* @category elements
|
| 427 |
+
* @since 2.0.0
|
| 428 |
*/
|
| 429 |
export declare const getHash: {
|
| 430 |
/**
|
| 431 |
+
* Looks up the value for the specified key in the `HashMap` safely using a custom hash.
|
| 432 |
+
*
|
| 433 |
+
* **Example** (Looking up values with a hash)
|
| 434 |
*
|
|
|
|
| 435 |
* ```ts
|
| 436 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 437 |
*
|
| 438 |
* // Useful when implementing custom equality for complex keys
|
| 439 |
* const userMap = HashMap.make(
|
|
|
|
| 454 |
* console.log(notFound) // Option.none()
|
| 455 |
* ```
|
| 456 |
*
|
|
|
|
| 457 |
* @category elements
|
| 458 |
+
* @since 2.0.0
|
| 459 |
*/
|
| 460 |
<K1 extends K, K>(key: K1, hash: number): <V>(self: HashMap<K, V>) => Option<V>;
|
| 461 |
/**
|
| 462 |
+
* Looks up the value for the specified key in the `HashMap` safely using a custom hash.
|
| 463 |
+
*
|
| 464 |
+
* **Example** (Looking up values with a hash)
|
| 465 |
*
|
|
|
|
| 466 |
* ```ts
|
| 467 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 468 |
*
|
| 469 |
* // Useful when implementing custom equality for complex keys
|
| 470 |
* const userMap = HashMap.make(
|
|
|
|
| 485 |
* console.log(notFound) // Option.none()
|
| 486 |
* ```
|
| 487 |
*
|
|
|
|
| 488 |
* @category elements
|
| 489 |
+
* @since 2.0.0
|
| 490 |
*/
|
| 491 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1, hash: number): Option<V>;
|
| 492 |
};
|
| 493 |
/**
|
| 494 |
+
* Looks up the value for the specified key in the `HashMap` unsafely using the
|
| 495 |
* internal hashing function.
|
| 496 |
*
|
| 497 |
+
* **When to use**
|
| 498 |
+
*
|
| 499 |
+
* Use when reading from a `HashMap` by a key known to exist, and throwing is an
|
| 500 |
+
* acceptable programming error for a missing key.
|
| 501 |
+
*
|
| 502 |
+
* **Gotchas**
|
| 503 |
+
*
|
| 504 |
+
* This function throws an error if the key is not found. Use `HashMap.get` for
|
| 505 |
+
* safe access that returns `Option`.
|
| 506 |
+
*
|
| 507 |
+
* **Example** (Unsafely looking up values)
|
| 508 |
*
|
|
|
|
| 509 |
* ```ts
|
| 510 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 511 |
*
|
| 512 |
* const config = HashMap.make(
|
| 513 |
* ["api_url", "https://api.example.com"],
|
|
|
|
| 529 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 530 |
* ```
|
| 531 |
*
|
|
|
|
| 532 |
* @category unsafe
|
| 533 |
+
* @since 4.0.0
|
| 534 |
*/
|
| 535 |
export declare const getUnsafe: {
|
| 536 |
/**
|
| 537 |
+
* Looks up the value for the specified key in the `HashMap` unsafely using the
|
| 538 |
* internal hashing function.
|
| 539 |
*
|
| 540 |
+
* **When to use**
|
| 541 |
+
*
|
| 542 |
+
* Use when reading from a `HashMap` by a key known to exist, and throwing is an
|
| 543 |
+
* acceptable programming error for a missing key.
|
| 544 |
+
*
|
| 545 |
+
* **Gotchas**
|
| 546 |
+
*
|
| 547 |
+
* This function throws an error if the key is not found. Use `HashMap.get` for
|
| 548 |
+
* safe access that returns `Option`.
|
| 549 |
+
*
|
| 550 |
+
* **Example** (Unsafely looking up values)
|
| 551 |
*
|
|
|
|
| 552 |
* ```ts
|
| 553 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 554 |
*
|
| 555 |
* const config = HashMap.make(
|
| 556 |
* ["api_url", "https://api.example.com"],
|
|
|
|
| 572 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 573 |
* ```
|
| 574 |
*
|
|
|
|
| 575 |
* @category unsafe
|
| 576 |
+
* @since 4.0.0
|
| 577 |
*/
|
| 578 |
<K1 extends K, K>(key: K1): <V>(self: HashMap<K, V>) => V;
|
| 579 |
/**
|
| 580 |
+
* Looks up the value for the specified key in the `HashMap` unsafely using the
|
| 581 |
* internal hashing function.
|
| 582 |
*
|
| 583 |
+
* **When to use**
|
| 584 |
+
*
|
| 585 |
+
* Use when reading from a `HashMap` by a key known to exist, and throwing is an
|
| 586 |
+
* acceptable programming error for a missing key.
|
| 587 |
+
*
|
| 588 |
+
* **Gotchas**
|
| 589 |
+
*
|
| 590 |
+
* This function throws an error if the key is not found. Use `HashMap.get` for
|
| 591 |
+
* safe access that returns `Option`.
|
| 592 |
+
*
|
| 593 |
+
* **Example** (Unsafely looking up values)
|
| 594 |
*
|
|
|
|
| 595 |
* ```ts
|
| 596 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 597 |
*
|
| 598 |
* const config = HashMap.make(
|
| 599 |
* ["api_url", "https://api.example.com"],
|
|
|
|
| 615 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 616 |
* ```
|
| 617 |
*
|
|
|
|
| 618 |
* @category unsafe
|
| 619 |
+
* @since 4.0.0
|
| 620 |
*/
|
| 621 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): V;
|
| 622 |
};
|
| 623 |
/**
|
| 624 |
+
* Checks whether the specified key has an entry in the `HashMap`.
|
| 625 |
+
*
|
| 626 |
+
* **Example** (Checking for keys)
|
| 627 |
*
|
|
|
|
| 628 |
* ```ts
|
| 629 |
+
* import { HashMap } from "effect"
|
| 630 |
*
|
| 631 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 632 |
*
|
|
|
|
| 638 |
* console.log(hasB) // true
|
| 639 |
* ```
|
| 640 |
*
|
|
|
|
| 641 |
* @category elements
|
| 642 |
+
* @since 2.0.0
|
| 643 |
*/
|
| 644 |
export declare const has: {
|
| 645 |
/**
|
| 646 |
+
* Checks whether the specified key has an entry in the `HashMap`.
|
| 647 |
+
*
|
| 648 |
+
* **Example** (Checking for keys)
|
| 649 |
*
|
|
|
|
| 650 |
* ```ts
|
| 651 |
+
* import { HashMap } from "effect"
|
| 652 |
*
|
| 653 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 654 |
*
|
|
|
|
| 660 |
* console.log(hasB) // true
|
| 661 |
* ```
|
| 662 |
*
|
|
|
|
| 663 |
* @category elements
|
| 664 |
+
* @since 2.0.0
|
| 665 |
*/
|
| 666 |
<K1 extends K, K>(key: K1): <K, V>(self: HashMap<K, V>) => boolean;
|
| 667 |
/**
|
| 668 |
+
* Checks whether the specified key has an entry in the `HashMap`.
|
| 669 |
+
*
|
| 670 |
+
* **Example** (Checking for keys)
|
| 671 |
*
|
|
|
|
| 672 |
* ```ts
|
| 673 |
+
* import { HashMap } from "effect"
|
| 674 |
*
|
| 675 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 676 |
*
|
|
|
|
| 682 |
* console.log(hasB) // true
|
| 683 |
* ```
|
| 684 |
*
|
|
|
|
| 685 |
* @category elements
|
| 686 |
+
* @since 2.0.0
|
| 687 |
*/
|
| 688 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1): boolean;
|
| 689 |
};
|
| 690 |
/**
|
| 691 |
+
* Checks whether the specified key has an entry in the `HashMap` using a custom
|
| 692 |
* hash.
|
| 693 |
*
|
| 694 |
+
* **Example** (Checking keys with a hash)
|
| 695 |
+
*
|
| 696 |
* ```ts
|
| 697 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 698 |
*
|
| 699 |
* // Create a map with case-sensitive keys
|
| 700 |
* const userMap = HashMap.make(
|
|
|
|
| 706 |
* const exactHash = Hash.string("Admin")
|
| 707 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 708 |
*
|
| 709 |
+
* // A matching hash does not override key equality
|
| 710 |
+
* console.log(HashMap.hasHash(userMap, "admin", exactHash)) // false
|
| 711 |
+
*
|
| 712 |
+
* // A different hash also cannot find the existing key
|
| 713 |
+
* const lowercaseHash = Hash.string("admin")
|
| 714 |
+
* console.log(HashMap.hasHash(userMap, "Admin", lowercaseHash)) // false
|
| 715 |
* ```
|
| 716 |
*
|
|
|
|
| 717 |
* @category elements
|
| 718 |
+
* @since 2.0.0
|
| 719 |
*/
|
| 720 |
export declare const hasHash: {
|
| 721 |
/**
|
| 722 |
+
* Checks whether the specified key has an entry in the `HashMap` using a custom
|
| 723 |
* hash.
|
| 724 |
*
|
| 725 |
+
* **Example** (Checking keys with a hash)
|
| 726 |
+
*
|
| 727 |
* ```ts
|
| 728 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 729 |
*
|
| 730 |
* // Create a map with case-sensitive keys
|
| 731 |
* const userMap = HashMap.make(
|
|
|
|
| 737 |
* const exactHash = Hash.string("Admin")
|
| 738 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 739 |
*
|
| 740 |
+
* // A matching hash does not override key equality
|
| 741 |
+
* console.log(HashMap.hasHash(userMap, "admin", exactHash)) // false
|
| 742 |
+
*
|
| 743 |
+
* // A different hash also cannot find the existing key
|
| 744 |
+
* const lowercaseHash = Hash.string("admin")
|
| 745 |
+
* console.log(HashMap.hasHash(userMap, "Admin", lowercaseHash)) // false
|
| 746 |
* ```
|
| 747 |
*
|
|
|
|
| 748 |
* @category elements
|
| 749 |
+
* @since 2.0.0
|
| 750 |
*/
|
| 751 |
<K1 extends K, K>(key: K1, hash: number): <V>(self: HashMap<K, V>) => boolean;
|
| 752 |
/**
|
| 753 |
+
* Checks whether the specified key has an entry in the `HashMap` using a custom
|
| 754 |
* hash.
|
| 755 |
*
|
| 756 |
+
* **Example** (Checking keys with a hash)
|
| 757 |
+
*
|
| 758 |
* ```ts
|
| 759 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 760 |
*
|
| 761 |
* // Create a map with case-sensitive keys
|
| 762 |
* const userMap = HashMap.make(
|
|
|
|
| 768 |
* const exactHash = Hash.string("Admin")
|
| 769 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 770 |
*
|
| 771 |
+
* // A matching hash does not override key equality
|
| 772 |
+
* console.log(HashMap.hasHash(userMap, "admin", exactHash)) // false
|
| 773 |
+
*
|
| 774 |
+
* // A different hash also cannot find the existing key
|
| 775 |
+
* const lowercaseHash = Hash.string("admin")
|
| 776 |
+
* console.log(HashMap.hasHash(userMap, "Admin", lowercaseHash)) // false
|
| 777 |
* ```
|
| 778 |
*
|
|
|
|
| 779 |
* @category elements
|
| 780 |
+
* @since 2.0.0
|
| 781 |
*/
|
| 782 |
<K1 extends K, K, V>(self: HashMap<K, V>, key: K1, hash: number): boolean;
|
| 783 |
};
|
| 784 |
/**
|
| 785 |
+
* Checks whether an element matching the given predicate exists in the given `HashMap`.
|
| 786 |
+
*
|
| 787 |
+
* **Example** (Checking entries by predicate)
|
| 788 |
*
|
|
|
|
| 789 |
* ```ts
|
| 790 |
+
* import { HashMap } from "effect"
|
| 791 |
*
|
| 792 |
* const hm = HashMap.make([1, "a"])
|
| 793 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 794 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 795 |
* ```
|
| 796 |
*
|
|
|
|
| 797 |
* @category elements
|
| 798 |
+
* @since 3.16.0
|
| 799 |
*/
|
| 800 |
export declare const hasBy: {
|
| 801 |
/**
|
| 802 |
+
* Checks whether an element matching the given predicate exists in the given `HashMap`.
|
| 803 |
+
*
|
| 804 |
+
* **Example** (Checking entries by predicate)
|
| 805 |
*
|
|
|
|
| 806 |
* ```ts
|
| 807 |
+
* import { HashMap } from "effect"
|
| 808 |
*
|
| 809 |
* const hm = HashMap.make([1, "a"])
|
| 810 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 811 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 812 |
* ```
|
| 813 |
*
|
|
|
|
| 814 |
* @category elements
|
| 815 |
+
* @since 3.16.0
|
| 816 |
*/
|
| 817 |
<K, V>(predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): (self: HashMap<K, V>) => boolean;
|
| 818 |
/**
|
| 819 |
+
* Checks whether an element matching the given predicate exists in the given `HashMap`.
|
| 820 |
+
*
|
| 821 |
+
* **Example** (Checking entries by predicate)
|
| 822 |
*
|
|
|
|
| 823 |
* ```ts
|
| 824 |
+
* import { HashMap } from "effect"
|
| 825 |
*
|
| 826 |
* const hm = HashMap.make([1, "a"])
|
| 827 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 828 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 829 |
* ```
|
| 830 |
*
|
|
|
|
| 831 |
* @category elements
|
| 832 |
+
* @since 3.16.0
|
| 833 |
*/
|
| 834 |
<K, V>(self: HashMap<K, V>, predicate: (value: NoInfer<V>, key: NoInfer<K>) => boolean): boolean;
|
| 835 |
};
|
|
|
|
| 837 |
* Sets the specified key to the specified value using the internal hashing
|
| 838 |
* function.
|
| 839 |
*
|
| 840 |
+
* **Example** (Setting a value)
|
| 841 |
+
*
|
| 842 |
* ```ts
|
| 843 |
+
* import { HashMap } from "effect"
|
| 844 |
*
|
| 845 |
* const map1 = HashMap.make(["a", 1])
|
| 846 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
|
|
| 852 |
* console.log(HashMap.size(map1)) // 1
|
| 853 |
* ```
|
| 854 |
*
|
| 855 |
+
* @category transforming
|
| 856 |
* @since 2.0.0
|
|
|
|
| 857 |
*/
|
| 858 |
export declare const set: {
|
| 859 |
/**
|
| 860 |
* Sets the specified key to the specified value using the internal hashing
|
| 861 |
* function.
|
| 862 |
*
|
| 863 |
+
* **Example** (Setting a value)
|
| 864 |
+
*
|
| 865 |
* ```ts
|
| 866 |
+
* import { HashMap } from "effect"
|
| 867 |
*
|
| 868 |
* const map1 = HashMap.make(["a", 1])
|
| 869 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
|
|
| 875 |
* console.log(HashMap.size(map1)) // 1
|
| 876 |
* ```
|
| 877 |
*
|
| 878 |
+
* @category transforming
|
| 879 |
* @since 2.0.0
|
|
|
|
| 880 |
*/
|
| 881 |
<K, V>(key: K, value: V): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 882 |
/**
|
| 883 |
* Sets the specified key to the specified value using the internal hashing
|
| 884 |
* function.
|
| 885 |
*
|
| 886 |
+
* **Example** (Setting a value)
|
| 887 |
+
*
|
| 888 |
* ```ts
|
| 889 |
+
* import { HashMap } from "effect"
|
| 890 |
*
|
| 891 |
* const map1 = HashMap.make(["a", 1])
|
| 892 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
|
|
| 898 |
* console.log(HashMap.size(map1)) // 1
|
| 899 |
* ```
|
| 900 |
*
|
| 901 |
+
* @category transforming
|
| 902 |
* @since 2.0.0
|
|
|
|
| 903 |
*/
|
| 904 |
<K, V>(self: HashMap<K, V>, key: K, value: V): HashMap<K, V>;
|
| 905 |
};
|
| 906 |
/**
|
| 907 |
* Returns an `IterableIterator` of the keys within the `HashMap`.
|
| 908 |
*
|
| 909 |
+
* **Example** (Iterating keys)
|
| 910 |
+
*
|
| 911 |
* ```ts
|
| 912 |
+
* import { HashMap } from "effect"
|
| 913 |
*
|
| 914 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 915 |
* const keys = Array.from(HashMap.keys(map))
|
| 916 |
* console.log(keys.sort()) // ["a", "b", "c"]
|
| 917 |
* ```
|
| 918 |
*
|
|
|
|
| 919 |
* @category getters
|
| 920 |
+
* @since 2.0.0
|
| 921 |
*/
|
| 922 |
export declare const keys: <K, V>(self: HashMap<K, V>) => IterableIterator<K>;
|
| 923 |
/**
|
| 924 |
* Returns an `IterableIterator` of the values within the `HashMap`.
|
| 925 |
*
|
| 926 |
+
* **Example** (Iterating values)
|
| 927 |
+
*
|
| 928 |
* ```ts
|
| 929 |
+
* import { HashMap } from "effect"
|
| 930 |
*
|
| 931 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 932 |
* const values = Array.from(HashMap.values(map))
|
| 933 |
* console.log(values.sort()) // [1, 2, 3]
|
| 934 |
* ```
|
| 935 |
*
|
|
|
|
| 936 |
* @category getters
|
| 937 |
+
* @since 2.0.0
|
| 938 |
*/
|
| 939 |
export declare const values: <K, V>(self: HashMap<K, V>) => IterableIterator<V>;
|
| 940 |
/**
|
| 941 |
* Returns an `Array` of the values within the `HashMap`.
|
| 942 |
*
|
| 943 |
+
* **Example** (Converting values to an array)
|
| 944 |
+
*
|
| 945 |
* ```ts
|
| 946 |
+
* import { HashMap } from "effect"
|
| 947 |
*
|
| 948 |
* const employees = HashMap.make(
|
| 949 |
* ["alice", { department: "engineering", salary: 90000 }],
|
|
|
|
| 964 |
* console.log(engineers.length) // 2
|
| 965 |
* ```
|
| 966 |
*
|
|
|
|
| 967 |
* @category getters
|
| 968 |
+
* @since 3.13.0
|
| 969 |
*/
|
| 970 |
export declare const toValues: <K, V>(self: HashMap<K, V>) => Array<V>;
|
| 971 |
/**
|
| 972 |
* Returns an `IterableIterator` of the entries within the `HashMap`.
|
| 973 |
*
|
| 974 |
+
* **Example** (Iterating entries)
|
| 975 |
+
*
|
| 976 |
* ```ts
|
| 977 |
+
* import { HashMap } from "effect"
|
| 978 |
*
|
| 979 |
* // Create a configuration map
|
| 980 |
* const config = HashMap.make(
|
|
|
|
| 983 |
* ["cache.enabled", "true"]
|
| 984 |
* )
|
| 985 |
*
|
| 986 |
+
* // Sort the derived array for deterministic output
|
| 987 |
+
* const settings = Array.from(HashMap.entries(config))
|
| 988 |
+
* .sort(([left], [right]) => left.localeCompare(right))
|
| 989 |
+
* .map(([key, value]) => `Setting ${key} = ${value}`)
|
| 990 |
*
|
| 991 |
+
* console.log(settings)
|
| 992 |
+
* // ["Setting cache.enabled = true", "Setting database.host = localhost", "Setting database.port = 5432"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 993 |
*
|
| 994 |
* // Convert to array when you need all entries at once
|
| 995 |
* const allEntries = Array.from(HashMap.entries(config))
|
| 996 |
* console.log(allEntries.length) // 3
|
| 997 |
* ```
|
| 998 |
*
|
|
|
|
| 999 |
* @category getters
|
| 1000 |
+
* @since 2.0.0
|
| 1001 |
*/
|
| 1002 |
export declare const entries: <K, V>(self: HashMap<K, V>) => IterableIterator<[K, V]>;
|
| 1003 |
/**
|
| 1004 |
* Returns an `Array<[K, V]>` of the entries within the `HashMap`.
|
| 1005 |
*
|
| 1006 |
+
* **Example** (Converting entries to an array)
|
| 1007 |
+
*
|
| 1008 |
* ```ts
|
| 1009 |
+
* import { HashMap } from "effect"
|
| 1010 |
*
|
| 1011 |
* const gameScores = HashMap.make(
|
| 1012 |
* ["alice", 1250],
|
|
|
|
| 1029 |
* const sortedMap = HashMap.fromIterable(scoreEntries)
|
| 1030 |
* ```
|
| 1031 |
*
|
|
|
|
| 1032 |
* @category getters
|
| 1033 |
+
* @since 2.0.0
|
| 1034 |
*/
|
| 1035 |
export declare const toEntries: <K, V>(self: HashMap<K, V>) => Array<[K, V]>;
|
| 1036 |
/**
|
| 1037 |
* Returns the number of entries within the `HashMap`.
|
| 1038 |
*
|
| 1039 |
+
* **Example** (Getting the size)
|
| 1040 |
+
*
|
| 1041 |
* ```ts
|
| 1042 |
+
* import { HashMap } from "effect"
|
| 1043 |
*
|
| 1044 |
* const emptyMap = HashMap.empty<string, number>()
|
| 1045 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
|
|
| 1048 |
* console.log(HashMap.size(map)) // 3
|
| 1049 |
* ```
|
| 1050 |
*
|
|
|
|
| 1051 |
* @category getters
|
| 1052 |
+
* @since 2.0.0
|
| 1053 |
*/
|
| 1054 |
export declare const size: <K, V>(self: HashMap<K, V>) => number;
|
| 1055 |
/**
|
| 1056 |
+
* Creates a transient mutable `HashMap` for efficient batched updates.
|
| 1057 |
+
*
|
| 1058 |
+
* **Details**
|
| 1059 |
+
*
|
| 1060 |
+
* Apply updates to the returned map, then call `endMutation` to finish the
|
| 1061 |
+
* mutation window and use the result as an immutable `HashMap`.
|
| 1062 |
+
*
|
| 1063 |
+
* **Example** (Beginning batch mutation)
|
| 1064 |
*
|
|
|
|
| 1065 |
* ```ts
|
| 1066 |
+
* import { HashMap } from "effect"
|
| 1067 |
*
|
| 1068 |
* const map = HashMap.make(["a", 1])
|
| 1069 |
*
|
|
|
|
| 1080 |
* console.log(HashMap.size(result)) // 2
|
| 1081 |
* ```
|
| 1082 |
*
|
|
|
|
| 1083 |
* @category mutations
|
| 1084 |
+
* @since 2.0.0
|
| 1085 |
*/
|
| 1086 |
export declare const beginMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1087 |
/**
|
| 1088 |
* Marks the `HashMap` as immutable, completing the mutation cycle.
|
| 1089 |
*
|
| 1090 |
+
* **Example** (Ending batch mutation)
|
| 1091 |
+
*
|
| 1092 |
* ```ts
|
| 1093 |
+
* import { HashMap } from "effect"
|
| 1094 |
*
|
| 1095 |
* // Start with an existing map
|
| 1096 |
* const original = HashMap.make(["x", 10], ["y", 20])
|
|
|
|
| 1111 |
* console.log(HashMap.get(final, "z")) // Option.some(30)
|
| 1112 |
* ```
|
| 1113 |
*
|
|
|
|
| 1114 |
* @category mutations
|
| 1115 |
+
* @since 2.0.0
|
| 1116 |
*/
|
| 1117 |
export declare const endMutation: <K, V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1118 |
/**
|
| 1119 |
+
* Runs a batch of updates against a transient mutable copy of the `HashMap`
|
| 1120 |
+
* and returns the finalized immutable result.
|
| 1121 |
+
*
|
| 1122 |
+
* **Details**
|
| 1123 |
+
*
|
| 1124 |
+
* The callback may call mutation-oriented helpers such as `set` and `remove`
|
| 1125 |
+
* on the transient map.
|
| 1126 |
+
*
|
| 1127 |
+
* **Example** (Applying batched mutations)
|
| 1128 |
*
|
|
|
|
| 1129 |
* ```ts
|
| 1130 |
+
* import { HashMap } from "effect"
|
| 1131 |
*
|
| 1132 |
* const map1 = HashMap.make(["a", 1])
|
| 1133 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
|
|
| 1137 |
* // Returns a new HashMap with mutations applied
|
| 1138 |
* ```
|
| 1139 |
*
|
|
|
|
| 1140 |
* @category mutations
|
| 1141 |
+
* @since 2.0.0
|
| 1142 |
*/
|
| 1143 |
export declare const mutate: {
|
| 1144 |
/**
|
| 1145 |
+
* Runs a batch of updates against a transient mutable copy of the `HashMap`
|
| 1146 |
+
* and returns the finalized immutable result.
|
| 1147 |
+
*
|
| 1148 |
+
* **Details**
|
| 1149 |
+
*
|
| 1150 |
+
* The callback may call mutation-oriented helpers such as `set` and `remove`
|
| 1151 |
+
* on the transient map.
|
| 1152 |
+
*
|
| 1153 |
+
* **Example** (Applying batched mutations)
|
| 1154 |
*
|
|
|
|
| 1155 |
* ```ts
|
| 1156 |
+
* import { HashMap } from "effect"
|
| 1157 |
*
|
| 1158 |
* const map1 = HashMap.make(["a", 1])
|
| 1159 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
|
|
| 1163 |
* // Returns a new HashMap with mutations applied
|
| 1164 |
* ```
|
| 1165 |
*
|
|
|
|
| 1166 |
* @category mutations
|
| 1167 |
+
* @since 2.0.0
|
| 1168 |
*/
|
| 1169 |
<K, V>(f: (self: HashMap<K, V>) => void): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1170 |
/**
|
| 1171 |
+
* Runs a batch of updates against a transient mutable copy of the `HashMap`
|
| 1172 |
+
* and returns the finalized immutable result.
|
| 1173 |
+
*
|
| 1174 |
+
* **Details**
|
| 1175 |
+
*
|
| 1176 |
+
* The callback may call mutation-oriented helpers such as `set` and `remove`
|
| 1177 |
+
* on the transient map.
|
| 1178 |
+
*
|
| 1179 |
+
* **Example** (Applying batched mutations)
|
| 1180 |
*
|
|
|
|
| 1181 |
* ```ts
|
| 1182 |
+
* import { HashMap } from "effect"
|
| 1183 |
*
|
| 1184 |
* const map1 = HashMap.make(["a", 1])
|
| 1185 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
|
|
| 1189 |
* // Returns a new HashMap with mutations applied
|
| 1190 |
* ```
|
| 1191 |
*
|
|
|
|
| 1192 |
* @category mutations
|
| 1193 |
+
* @since 2.0.0
|
| 1194 |
*/
|
| 1195 |
<K, V>(self: HashMap<K, V>, f: (self: HashMap<K, V>) => void): HashMap<K, V>;
|
| 1196 |
};
|
| 1197 |
/**
|
| 1198 |
+
* Sets or removes the specified key using an update function.
|
|
|
|
|
|
|
| 1199 |
*
|
| 1200 |
+
* **Details**
|
| 1201 |
+
*
|
| 1202 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1203 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1204 |
+
* `None` removes the key or leaves it absent.
|
| 1205 |
+
*
|
| 1206 |
+
* **Example** (Updating values with Options)
|
| 1207 |
*
|
|
|
|
| 1208 |
* ```ts
|
| 1209 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 1210 |
*
|
| 1211 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1212 |
*
|
|
|
|
| 1218 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1219 |
* ```
|
| 1220 |
*
|
| 1221 |
+
* @category transforming
|
| 1222 |
* @since 2.0.0
|
|
|
|
| 1223 |
*/
|
| 1224 |
export declare const modifyAt: {
|
| 1225 |
/**
|
| 1226 |
+
* Sets or removes the specified key using an update function.
|
| 1227 |
+
*
|
| 1228 |
+
* **Details**
|
| 1229 |
+
*
|
| 1230 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1231 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1232 |
+
* `None` removes the key or leaves it absent.
|
| 1233 |
*
|
| 1234 |
+
* **Example** (Updating values with Options)
|
|
|
|
| 1235 |
*
|
|
|
|
| 1236 |
* ```ts
|
| 1237 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 1238 |
*
|
| 1239 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1240 |
*
|
|
|
|
| 1246 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1247 |
* ```
|
| 1248 |
*
|
| 1249 |
+
* @category transforming
|
| 1250 |
* @since 2.0.0
|
|
|
|
| 1251 |
*/
|
| 1252 |
<K, V>(key: K, f: HashMap.UpdateFn<V>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1253 |
/**
|
| 1254 |
+
* Sets or removes the specified key using an update function.
|
|
|
|
|
|
|
| 1255 |
*
|
| 1256 |
+
* **Details**
|
| 1257 |
+
*
|
| 1258 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1259 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1260 |
+
* `None` removes the key or leaves it absent.
|
| 1261 |
+
*
|
| 1262 |
+
* **Example** (Updating values with Options)
|
| 1263 |
*
|
|
|
|
| 1264 |
* ```ts
|
| 1265 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 1266 |
*
|
| 1267 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1268 |
*
|
|
|
|
| 1274 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 1275 |
* ```
|
| 1276 |
*
|
| 1277 |
+
* @category transforming
|
| 1278 |
* @since 2.0.0
|
|
|
|
| 1279 |
*/
|
| 1280 |
<K, V>(self: HashMap<K, V>, key: K, f: HashMap.UpdateFn<V>): HashMap<K, V>;
|
| 1281 |
};
|
| 1282 |
/**
|
| 1283 |
+
* Sets or removes the specified key using a precomputed hash and an update
|
| 1284 |
+
* function.
|
| 1285 |
+
*
|
| 1286 |
+
* **Details**
|
| 1287 |
*
|
| 1288 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1289 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1290 |
+
* `None` removes the key or leaves it absent.
|
| 1291 |
*
|
| 1292 |
+
* **Example** (Updating values with a hash)
|
| 1293 |
*
|
|
|
|
| 1294 |
* ```ts
|
| 1295 |
+
* import { Hash, HashMap, Option } from "effect"
|
|
|
|
|
|
|
| 1296 |
*
|
| 1297 |
* // Useful when working with precomputed hashes for performance
|
| 1298 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
|
|
| 1326 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1327 |
* ```
|
| 1328 |
*
|
| 1329 |
+
* @category transforming
|
| 1330 |
* @since 2.0.0
|
|
|
|
| 1331 |
*/
|
| 1332 |
export declare const modifyHash: {
|
| 1333 |
/**
|
| 1334 |
+
* Sets or removes the specified key using a precomputed hash and an update
|
| 1335 |
+
* function.
|
| 1336 |
+
*
|
| 1337 |
+
* **Details**
|
| 1338 |
*
|
| 1339 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1340 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1341 |
+
* `None` removes the key or leaves it absent.
|
| 1342 |
*
|
| 1343 |
+
* **Example** (Updating values with a hash)
|
| 1344 |
*
|
|
|
|
| 1345 |
* ```ts
|
| 1346 |
+
* import { Hash, HashMap, Option } from "effect"
|
|
|
|
|
|
|
| 1347 |
*
|
| 1348 |
* // Useful when working with precomputed hashes for performance
|
| 1349 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
|
|
| 1377 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1378 |
* ```
|
| 1379 |
*
|
| 1380 |
+
* @category transforming
|
| 1381 |
* @since 2.0.0
|
|
|
|
| 1382 |
*/
|
| 1383 |
<K, V>(key: K, hash: number, f: HashMap.UpdateFn<V>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1384 |
/**
|
| 1385 |
+
* Sets or removes the specified key using a precomputed hash and an update
|
| 1386 |
+
* function.
|
|
|
|
| 1387 |
*
|
| 1388 |
+
* **Details**
|
|
|
|
| 1389 |
*
|
| 1390 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 1391 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 1392 |
+
* `None` removes the key or leaves it absent.
|
| 1393 |
+
*
|
| 1394 |
+
* **Example** (Updating values with a hash)
|
| 1395 |
*
|
|
|
|
| 1396 |
* ```ts
|
| 1397 |
+
* import { Hash, HashMap, Option } from "effect"
|
|
|
|
|
|
|
| 1398 |
*
|
| 1399 |
* // Useful when working with precomputed hashes for performance
|
| 1400 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
|
|
| 1428 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 1429 |
* ```
|
| 1430 |
*
|
| 1431 |
+
* @category transforming
|
| 1432 |
* @since 2.0.0
|
|
|
|
| 1433 |
*/
|
| 1434 |
<K, V>(self: HashMap<K, V>, key: K, hash: number, f: HashMap.UpdateFn<V>): HashMap<K, V>;
|
| 1435 |
};
|
| 1436 |
/**
|
| 1437 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1438 |
*
|
| 1439 |
+
* **Example** (Modifying existing values)
|
| 1440 |
+
*
|
| 1441 |
* ```ts
|
| 1442 |
+
* import { HashMap } from "effect"
|
| 1443 |
*
|
| 1444 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1445 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
|
|
| 1448 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1449 |
* ```
|
| 1450 |
*
|
| 1451 |
+
* @category transforming
|
| 1452 |
* @since 2.0.0
|
|
|
|
| 1453 |
*/
|
| 1454 |
export declare const modify: {
|
| 1455 |
/**
|
| 1456 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1457 |
*
|
| 1458 |
+
* **Example** (Modifying existing values)
|
| 1459 |
+
*
|
| 1460 |
* ```ts
|
| 1461 |
+
* import { HashMap } from "effect"
|
| 1462 |
*
|
| 1463 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1464 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
|
|
| 1467 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1468 |
* ```
|
| 1469 |
*
|
| 1470 |
+
* @category transforming
|
| 1471 |
* @since 2.0.0
|
|
|
|
| 1472 |
*/
|
| 1473 |
<K, V>(key: K, f: (v: V) => V): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1474 |
/**
|
| 1475 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 1476 |
*
|
| 1477 |
+
* **Example** (Modifying existing values)
|
| 1478 |
+
*
|
| 1479 |
* ```ts
|
| 1480 |
+
* import { HashMap } from "effect"
|
| 1481 |
*
|
| 1482 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1483 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
|
|
| 1486 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 1487 |
* ```
|
| 1488 |
*
|
| 1489 |
+
* @category transforming
|
| 1490 |
* @since 2.0.0
|
|
|
|
| 1491 |
*/
|
| 1492 |
<K, V>(self: HashMap<K, V>, key: K, f: (v: V) => V): HashMap<K, V>;
|
| 1493 |
};
|
| 1494 |
/**
|
| 1495 |
+
* Combines two `HashMap`s into one.
|
| 1496 |
+
*
|
| 1497 |
+
* **Details**
|
| 1498 |
+
*
|
| 1499 |
+
* Entries from `that` are inserted into `self`; when both maps contain an
|
| 1500 |
+
* equal key, the value from `that` replaces the value from `self`.
|
| 1501 |
+
*
|
| 1502 |
+
* **Example** (Combining HashMaps)
|
| 1503 |
*
|
|
|
|
| 1504 |
* ```ts
|
| 1505 |
+
* import { HashMap } from "effect"
|
| 1506 |
*
|
| 1507 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1508 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
|
|
| 1512 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1513 |
* ```
|
| 1514 |
*
|
|
|
|
| 1515 |
* @category combining
|
| 1516 |
+
* @since 2.0.0
|
| 1517 |
*/
|
| 1518 |
export declare const union: {
|
| 1519 |
/**
|
| 1520 |
+
* Combines two `HashMap`s into one.
|
| 1521 |
+
*
|
| 1522 |
+
* **Details**
|
| 1523 |
+
*
|
| 1524 |
+
* Entries from `that` are inserted into `self`; when both maps contain an
|
| 1525 |
+
* equal key, the value from `that` replaces the value from `self`.
|
| 1526 |
+
*
|
| 1527 |
+
* **Example** (Combining HashMaps)
|
| 1528 |
*
|
|
|
|
| 1529 |
* ```ts
|
| 1530 |
+
* import { HashMap } from "effect"
|
| 1531 |
*
|
| 1532 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1533 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
|
|
| 1537 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1538 |
* ```
|
| 1539 |
*
|
|
|
|
| 1540 |
* @category combining
|
| 1541 |
+
* @since 2.0.0
|
| 1542 |
*/
|
| 1543 |
<K1, V1>(that: HashMap<K1, V1>): <K0, V0>(self: HashMap<K0, V0>) => HashMap<K1 | K0, V1 | V0>;
|
| 1544 |
/**
|
| 1545 |
+
* Combines two `HashMap`s into one.
|
| 1546 |
+
*
|
| 1547 |
+
* **Details**
|
| 1548 |
+
*
|
| 1549 |
+
* Entries from `that` are inserted into `self`; when both maps contain an
|
| 1550 |
+
* equal key, the value from `that` replaces the value from `self`.
|
| 1551 |
+
*
|
| 1552 |
+
* **Example** (Combining HashMaps)
|
| 1553 |
*
|
|
|
|
| 1554 |
* ```ts
|
| 1555 |
+
* import { HashMap } from "effect"
|
| 1556 |
*
|
| 1557 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1558 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
|
|
| 1562 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 1563 |
* ```
|
| 1564 |
*
|
|
|
|
| 1565 |
* @category combining
|
| 1566 |
+
* @since 2.0.0
|
| 1567 |
*/
|
| 1568 |
<K0, V0, K1, V1>(self: HashMap<K0, V0>, that: HashMap<K1, V1>): HashMap<K0 | K1, V0 | V1>;
|
| 1569 |
};
|
| 1570 |
/**
|
| 1571 |
+
* Removes the entry for the specified key in the `HashMap` using the internal
|
| 1572 |
* hashing function.
|
| 1573 |
*
|
| 1574 |
+
* **Example** (Removing a key)
|
| 1575 |
+
*
|
| 1576 |
* ```ts
|
| 1577 |
+
* import { HashMap } from "effect"
|
| 1578 |
*
|
| 1579 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1580 |
* const map2 = HashMap.remove(map1, "b")
|
|
|
|
| 1584 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1585 |
* ```
|
| 1586 |
*
|
| 1587 |
+
* @category transforming
|
| 1588 |
* @since 2.0.0
|
|
|
|
| 1589 |
*/
|
| 1590 |
export declare const remove: {
|
| 1591 |
/**
|
| 1592 |
+
* Removes the entry for the specified key in the `HashMap` using the internal
|
| 1593 |
* hashing function.
|
| 1594 |
*
|
| 1595 |
+
* **Example** (Removing a key)
|
| 1596 |
+
*
|
| 1597 |
* ```ts
|
| 1598 |
+
* import { HashMap } from "effect"
|
| 1599 |
*
|
| 1600 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1601 |
* const map2 = HashMap.remove(map1, "b")
|
|
|
|
| 1605 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1606 |
* ```
|
| 1607 |
*
|
| 1608 |
+
* @category transforming
|
| 1609 |
* @since 2.0.0
|
|
|
|
| 1610 |
*/
|
| 1611 |
<K>(key: K): <V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1612 |
/**
|
| 1613 |
+
* Removes the entry for the specified key in the `HashMap` using the internal
|
| 1614 |
* hashing function.
|
| 1615 |
*
|
| 1616 |
+
* **Example** (Removing a key)
|
| 1617 |
+
*
|
| 1618 |
* ```ts
|
| 1619 |
+
* import { HashMap } from "effect"
|
| 1620 |
*
|
| 1621 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1622 |
* const map2 = HashMap.remove(map1, "b")
|
|
|
|
| 1626 |
* console.log(HashMap.has(map2, "a")) // true
|
| 1627 |
* ```
|
| 1628 |
*
|
| 1629 |
+
* @category transforming
|
| 1630 |
* @since 2.0.0
|
|
|
|
| 1631 |
*/
|
| 1632 |
<K, V>(self: HashMap<K, V>, key: K): HashMap<K, V>;
|
| 1633 |
};
|
| 1634 |
/**
|
| 1635 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1636 |
*
|
| 1637 |
+
* **Example** (Removing multiple keys)
|
| 1638 |
+
*
|
| 1639 |
* ```ts
|
| 1640 |
+
* import { HashMap } from "effect"
|
| 1641 |
*
|
| 1642 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1643 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
|
|
| 1647 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1648 |
* ```
|
| 1649 |
*
|
| 1650 |
+
* @category transforming
|
| 1651 |
* @since 2.0.0
|
|
|
|
| 1652 |
*/
|
| 1653 |
export declare const removeMany: {
|
| 1654 |
/**
|
| 1655 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1656 |
*
|
| 1657 |
+
* **Example** (Removing multiple keys)
|
| 1658 |
+
*
|
| 1659 |
* ```ts
|
| 1660 |
+
* import { HashMap } from "effect"
|
| 1661 |
*
|
| 1662 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1663 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
|
|
| 1667 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1668 |
* ```
|
| 1669 |
*
|
| 1670 |
+
* @category transforming
|
| 1671 |
* @since 2.0.0
|
|
|
|
| 1672 |
*/
|
| 1673 |
<K>(keys: Iterable<K>): <V>(self: HashMap<K, V>) => HashMap<K, V>;
|
| 1674 |
/**
|
| 1675 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 1676 |
*
|
| 1677 |
+
* **Example** (Removing multiple keys)
|
| 1678 |
+
*
|
| 1679 |
* ```ts
|
| 1680 |
+
* import { HashMap } from "effect"
|
| 1681 |
*
|
| 1682 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 1683 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
|
|
| 1687 |
* console.log(HashMap.has(map2, "c")) // true
|
| 1688 |
* ```
|
| 1689 |
*
|
| 1690 |
+
* @category transforming
|
| 1691 |
* @since 2.0.0
|
|
|
|
| 1692 |
*/
|
| 1693 |
<K, V>(self: HashMap<K, V>, keys: Iterable<K>): HashMap<K, V>;
|
| 1694 |
};
|
| 1695 |
/**
|
| 1696 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1697 |
*
|
| 1698 |
+
* **Example** (Setting multiple entries)
|
| 1699 |
+
*
|
| 1700 |
* ```ts
|
| 1701 |
+
* import { HashMap } from "effect"
|
| 1702 |
*
|
| 1703 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1704 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
|
|
| 1709 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1710 |
* ```
|
| 1711 |
*
|
| 1712 |
+
* @category transforming
|
| 1713 |
+
* @since 4.0.0
|
| 1714 |
*/
|
| 1715 |
export declare const setMany: {
|
| 1716 |
/**
|
| 1717 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1718 |
*
|
| 1719 |
+
* **Example** (Setting multiple entries)
|
| 1720 |
+
*
|
| 1721 |
* ```ts
|
| 1722 |
+
* import { HashMap } from "effect"
|
| 1723 |
*
|
| 1724 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1725 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
|
|
| 1730 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1731 |
* ```
|
| 1732 |
*
|
| 1733 |
+
* @category transforming
|
| 1734 |
+
* @since 4.0.0
|
| 1735 |
*/
|
| 1736 |
<K, V>(entries: Iterable<readonly [K, V]>): (self: HashMap<K, V>) => HashMap<K, V>;
|
| 1737 |
/**
|
| 1738 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 1739 |
*
|
| 1740 |
+
* **Example** (Setting multiple entries)
|
| 1741 |
+
*
|
| 1742 |
* ```ts
|
| 1743 |
+
* import { HashMap } from "effect"
|
| 1744 |
*
|
| 1745 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1746 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
|
|
| 1751 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 1752 |
* ```
|
| 1753 |
*
|
| 1754 |
+
* @category transforming
|
| 1755 |
+
* @since 4.0.0
|
| 1756 |
*/
|
| 1757 |
<K, V>(self: HashMap<K, V>, entries: Iterable<readonly [K, V]>): HashMap<K, V>;
|
| 1758 |
};
|
| 1759 |
/**
|
| 1760 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1761 |
*
|
| 1762 |
+
* **Example** (Mapping values)
|
| 1763 |
+
*
|
| 1764 |
* ```ts
|
| 1765 |
+
* import { HashMap } from "effect"
|
| 1766 |
*
|
| 1767 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1768 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
|
|
| 1771 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1772 |
* ```
|
| 1773 |
*
|
|
|
|
| 1774 |
* @category mapping
|
| 1775 |
+
* @since 2.0.0
|
| 1776 |
*/
|
| 1777 |
export declare const map: {
|
| 1778 |
/**
|
| 1779 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1780 |
*
|
| 1781 |
+
* **Example** (Mapping values)
|
| 1782 |
+
*
|
| 1783 |
* ```ts
|
| 1784 |
+
* import { HashMap } from "effect"
|
| 1785 |
*
|
| 1786 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1787 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
|
|
| 1790 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1791 |
* ```
|
| 1792 |
*
|
|
|
|
| 1793 |
* @category mapping
|
| 1794 |
+
* @since 2.0.0
|
| 1795 |
*/
|
| 1796 |
<A, V, K>(f: (value: V, key: K) => A): (self: HashMap<K, V>) => HashMap<K, A>;
|
| 1797 |
/**
|
| 1798 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 1799 |
*
|
| 1800 |
+
* **Example** (Mapping values)
|
| 1801 |
+
*
|
| 1802 |
* ```ts
|
| 1803 |
+
* import { HashMap } from "effect"
|
| 1804 |
*
|
| 1805 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1806 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
|
|
| 1809 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 1810 |
* ```
|
| 1811 |
*
|
|
|
|
| 1812 |
* @category mapping
|
| 1813 |
+
* @since 2.0.0
|
| 1814 |
*/
|
| 1815 |
<K, V, A>(self: HashMap<K, V>, f: (value: V, key: K) => A): HashMap<K, A>;
|
| 1816 |
};
|
| 1817 |
/**
|
| 1818 |
+
* Maps each entry to a `HashMap` and flattens the results.
|
| 1819 |
*
|
| 1820 |
+
* **Gotchas**
|
| 1821 |
+
*
|
| 1822 |
+
* The hash and equality behavior of both maps have to be the same.
|
| 1823 |
+
*
|
| 1824 |
+
* **Example** (FlatMapping values)
|
| 1825 |
*
|
|
|
|
| 1826 |
* ```ts
|
| 1827 |
+
* import { HashMap } from "effect"
|
| 1828 |
*
|
| 1829 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1830 |
* const map2 = HashMap.flatMap(
|
|
|
|
| 1837 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1838 |
* ```
|
| 1839 |
*
|
|
|
|
| 1840 |
* @category sequencing
|
| 1841 |
+
* @since 2.0.0
|
| 1842 |
*/
|
| 1843 |
export declare const flatMap: {
|
| 1844 |
/**
|
| 1845 |
+
* Maps each entry to a `HashMap` and flattens the results.
|
| 1846 |
*
|
| 1847 |
+
* **Gotchas**
|
| 1848 |
+
*
|
| 1849 |
+
* The hash and equality behavior of both maps have to be the same.
|
| 1850 |
+
*
|
| 1851 |
+
* **Example** (FlatMapping values)
|
| 1852 |
*
|
|
|
|
| 1853 |
* ```ts
|
| 1854 |
+
* import { HashMap } from "effect"
|
| 1855 |
*
|
| 1856 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1857 |
* const map2 = HashMap.flatMap(
|
|
|
|
| 1864 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1865 |
* ```
|
| 1866 |
*
|
|
|
|
| 1867 |
* @category sequencing
|
| 1868 |
+
* @since 2.0.0
|
| 1869 |
*/
|
| 1870 |
<A, K, B>(f: (value: A, key: K) => HashMap<K, B>): (self: HashMap<K, A>) => HashMap<K, B>;
|
| 1871 |
/**
|
| 1872 |
+
* Maps each entry to a `HashMap` and flattens the results.
|
| 1873 |
*
|
| 1874 |
+
* **Gotchas**
|
| 1875 |
+
*
|
| 1876 |
+
* The hash and equality behavior of both maps have to be the same.
|
| 1877 |
+
*
|
| 1878 |
+
* **Example** (FlatMapping values)
|
| 1879 |
*
|
|
|
|
| 1880 |
* ```ts
|
| 1881 |
+
* import { HashMap } from "effect"
|
| 1882 |
*
|
| 1883 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 1884 |
* const map2 = HashMap.flatMap(
|
|
|
|
| 1891 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 1892 |
* ```
|
| 1893 |
*
|
|
|
|
| 1894 |
* @category sequencing
|
| 1895 |
+
* @since 2.0.0
|
| 1896 |
*/
|
| 1897 |
<K, A, B>(self: HashMap<K, A>, f: (value: A, key: K) => HashMap<K, B>): HashMap<K, B>;
|
| 1898 |
};
|
| 1899 |
/**
|
| 1900 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1901 |
*
|
| 1902 |
+
* **Example** (Iterating with side effects)
|
| 1903 |
+
*
|
| 1904 |
* ```ts
|
| 1905 |
+
* import { HashMap } from "effect"
|
| 1906 |
*
|
| 1907 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1908 |
* const collected: Array<[string, number]> = []
|
|
|
|
| 1914 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1915 |
* ```
|
| 1916 |
*
|
|
|
|
| 1917 |
* @category traversing
|
| 1918 |
+
* @since 2.0.0
|
| 1919 |
*/
|
| 1920 |
export declare const forEach: {
|
| 1921 |
/**
|
| 1922 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1923 |
*
|
| 1924 |
+
* **Example** (Iterating with side effects)
|
| 1925 |
+
*
|
| 1926 |
* ```ts
|
| 1927 |
+
* import { HashMap } from "effect"
|
| 1928 |
*
|
| 1929 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1930 |
* const collected: Array<[string, number]> = []
|
|
|
|
| 1936 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1937 |
* ```
|
| 1938 |
*
|
|
|
|
| 1939 |
* @category traversing
|
| 1940 |
+
* @since 2.0.0
|
| 1941 |
*/
|
| 1942 |
<V, K>(f: (value: V, key: K) => void): (self: HashMap<K, V>) => void;
|
| 1943 |
/**
|
| 1944 |
* Applies the specified function to the entries of the `HashMap`.
|
| 1945 |
*
|
| 1946 |
+
* **Example** (Iterating with side effects)
|
| 1947 |
+
*
|
| 1948 |
* ```ts
|
| 1949 |
+
* import { HashMap } from "effect"
|
| 1950 |
*
|
| 1951 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 1952 |
* const collected: Array<[string, number]> = []
|
|
|
|
| 1958 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 1959 |
* ```
|
| 1960 |
*
|
|
|
|
| 1961 |
* @category traversing
|
| 1962 |
+
* @since 2.0.0
|
| 1963 |
*/
|
| 1964 |
<V, K>(self: HashMap<K, V>, f: (value: V, key: K) => void): void;
|
| 1965 |
};
|
| 1966 |
/**
|
| 1967 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 1968 |
*
|
| 1969 |
+
* **Example** (Reducing values)
|
| 1970 |
+
*
|
| 1971 |
* ```ts
|
| 1972 |
+
* import { HashMap } from "effect"
|
| 1973 |
*
|
| 1974 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1975 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
|
|
| 1977 |
* console.log(sum) // 6
|
| 1978 |
* ```
|
| 1979 |
*
|
|
|
|
| 1980 |
* @category folding
|
| 1981 |
+
* @since 2.0.0
|
| 1982 |
*/
|
| 1983 |
export declare const reduce: {
|
| 1984 |
/**
|
| 1985 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 1986 |
*
|
| 1987 |
+
* **Example** (Reducing values)
|
| 1988 |
+
*
|
| 1989 |
* ```ts
|
| 1990 |
+
* import { HashMap } from "effect"
|
| 1991 |
*
|
| 1992 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 1993 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
|
|
| 1995 |
* console.log(sum) // 6
|
| 1996 |
* ```
|
| 1997 |
*
|
|
|
|
| 1998 |
* @category folding
|
| 1999 |
+
* @since 2.0.0
|
| 2000 |
*/
|
| 2001 |
<Z, V, K>(zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: HashMap<K, V>) => Z;
|
| 2002 |
/**
|
| 2003 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 2004 |
*
|
| 2005 |
+
* **Example** (Reducing values)
|
| 2006 |
+
*
|
| 2007 |
* ```ts
|
| 2008 |
+
* import { HashMap } from "effect"
|
| 2009 |
*
|
| 2010 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2011 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
|
|
| 2013 |
* console.log(sum) // 6
|
| 2014 |
* ```
|
| 2015 |
*
|
|
|
|
| 2016 |
* @category folding
|
| 2017 |
+
* @since 2.0.0
|
| 2018 |
*/
|
| 2019 |
<K, V, Z>(self: HashMap<K, V>, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z;
|
| 2020 |
};
|
| 2021 |
/**
|
| 2022 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 2023 |
*
|
| 2024 |
+
* **Example** (Filtering entries)
|
| 2025 |
+
*
|
| 2026 |
* ```ts
|
| 2027 |
+
* import { HashMap } from "effect"
|
| 2028 |
*
|
| 2029 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2030 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
|
|
| 2035 |
* console.log(HashMap.has(map2, "a")) // false
|
| 2036 |
* ```
|
| 2037 |
*
|
|
|
|
| 2038 |
* @category filtering
|
| 2039 |
+
* @since 2.0.0
|
| 2040 |
*/
|
| 2041 |
export declare const filter: {
|
| 2042 |
/**
|
| 2043 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 2044 |
*
|
| 2045 |
+
* **Example** (Filtering entries)
|
| 2046 |
+
*
|
| 2047 |
* ```ts
|
| 2048 |
+
* import { HashMap } from "effect"
|
| 2049 |
*
|
| 2050 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2051 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
|
|
| 2056 |
* console.log(HashMap.has(map2, "a")) // false
|
| 2057 |
* ```
|
| 2058 |
*
|
|
|
|
| 2059 |
* @category filtering
|
| 2060 |
+
* @since 2.0.0
|
| 2061 |
*/
|
| 2062 |
<K, A>(f: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => HashMap<K, A>;
|
| 2063 |
/**
|
| 2064 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 2065 |
*
|
| 2066 |
+
* **Example** (Filtering entries)
|
| 2067 |
+
*
|
| 2068 |
* ```ts
|
| 2069 |
+
* import { HashMap } from "effect"
|
| 2070 |
*
|
| 2071 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2072 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
|
|
| 2077 |
* console.log(HashMap.has(map2, "a")) // false
|
| 2078 |
* ```
|
| 2079 |
*
|
|
|
|
| 2080 |
* @category filtering
|
| 2081 |
+
* @since 2.0.0
|
| 2082 |
*/
|
| 2083 |
<K, A>(self: HashMap<K, A>, f: (a: A, k: K) => boolean): HashMap<K, A>;
|
| 2084 |
};
|
| 2085 |
/**
|
| 2086 |
* Filters out `None` values from a `HashMap` of `Options`s.
|
| 2087 |
*
|
| 2088 |
+
* **Example** (Compacting Option values)
|
| 2089 |
+
*
|
| 2090 |
* ```ts
|
| 2091 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 2092 |
*
|
| 2093 |
* const map1 = HashMap.make(
|
| 2094 |
* ["a", Option.some(1)],
|
|
|
|
| 2102 |
* console.log(HashMap.has(map2, "b")) // false
|
| 2103 |
* ```
|
| 2104 |
*
|
|
|
|
| 2105 |
* @category filtering
|
| 2106 |
+
* @since 2.0.0
|
| 2107 |
*/
|
| 2108 |
export declare const compact: <K, A>(self: HashMap<K, Option<A>>) => HashMap<K, A>;
|
| 2109 |
/**
|
| 2110 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 2111 |
* only successful results.
|
| 2112 |
*
|
| 2113 |
+
* **Example** (Filtering and mapping Results)
|
| 2114 |
+
*
|
| 2115 |
* ```ts
|
| 2116 |
+
* import { HashMap, Result } from "effect"
|
|
|
|
| 2117 |
*
|
| 2118 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2119 |
* const map2 = HashMap.filterMap(
|
|
|
|
| 2126 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 2127 |
* ```
|
| 2128 |
*
|
|
|
|
| 2129 |
* @category filtering
|
| 2130 |
+
* @since 2.0.0
|
| 2131 |
*/
|
| 2132 |
export declare const filterMap: {
|
| 2133 |
/**
|
| 2134 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 2135 |
* only successful results.
|
| 2136 |
*
|
| 2137 |
+
* **Example** (Filtering and mapping Results)
|
| 2138 |
+
*
|
| 2139 |
* ```ts
|
| 2140 |
+
* import { HashMap, Result } from "effect"
|
|
|
|
| 2141 |
*
|
| 2142 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2143 |
* const map2 = HashMap.filterMap(
|
|
|
|
| 2150 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 2151 |
* ```
|
| 2152 |
*
|
|
|
|
| 2153 |
* @category filtering
|
| 2154 |
+
* @since 2.0.0
|
| 2155 |
*/
|
| 2156 |
<A, K, B, X>(f: (input: A, key: K) => Result<B, X>): (self: HashMap<K, A>) => HashMap<K, B>;
|
| 2157 |
/**
|
| 2158 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 2159 |
* only successful results.
|
| 2160 |
*
|
| 2161 |
+
* **Example** (Filtering and mapping Results)
|
| 2162 |
+
*
|
| 2163 |
* ```ts
|
| 2164 |
+
* import { HashMap, Result } from "effect"
|
|
|
|
| 2165 |
*
|
| 2166 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 2167 |
* const map2 = HashMap.filterMap(
|
|
|
|
| 2174 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 2175 |
* ```
|
| 2176 |
*
|
|
|
|
| 2177 |
* @category filtering
|
| 2178 |
+
* @since 2.0.0
|
| 2179 |
*/
|
| 2180 |
<K, A, B, X>(self: HashMap<K, A>, f: (input: A, key: K) => Result<B, X>): HashMap<K, B>;
|
| 2181 |
};
|
|
|
|
| 2183 |
* Returns the first element that satisfies the specified
|
| 2184 |
* predicate, or `None` if no such element exists.
|
| 2185 |
*
|
| 2186 |
+
* **Example** (Finding the first matching entry)
|
| 2187 |
+
*
|
| 2188 |
* ```ts
|
| 2189 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 2190 |
*
|
| 2191 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2192 |
+
* const result = HashMap.findFirst(map, (value, key) => key === "b" && value > 1)
|
| 2193 |
+
* console.log(result) // Option.some(["b", 2])
|
| 2194 |
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["b", 2]
|
| 2195 |
* ```
|
| 2196 |
*
|
| 2197 |
* @category elements
|
|
|
|
| 2202 |
* Returns the first element that satisfies the specified
|
| 2203 |
* predicate, or `None` if no such element exists.
|
| 2204 |
*
|
| 2205 |
+
* **Example** (Finding the first matching entry)
|
| 2206 |
+
*
|
| 2207 |
* ```ts
|
| 2208 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 2209 |
*
|
| 2210 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2211 |
+
* const result = HashMap.findFirst(map, (value, key) => key === "b" && value > 1)
|
| 2212 |
+
* console.log(result) // Option.some(["b", 2])
|
| 2213 |
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["b", 2]
|
| 2214 |
* ```
|
| 2215 |
*
|
| 2216 |
* @category elements
|
|
|
|
| 2221 |
* Returns the first element that satisfies the specified
|
| 2222 |
* predicate, or `None` if no such element exists.
|
| 2223 |
*
|
| 2224 |
+
* **Example** (Finding the first matching entry)
|
| 2225 |
+
*
|
| 2226 |
* ```ts
|
| 2227 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 2228 |
*
|
| 2229 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2230 |
+
* const result = HashMap.findFirst(map, (value, key) => key === "b" && value > 1)
|
| 2231 |
+
* console.log(result) // Option.some(["b", 2])
|
| 2232 |
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["b", 2]
|
| 2233 |
* ```
|
| 2234 |
*
|
| 2235 |
* @category elements
|
|
|
|
| 2238 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): Option<[K, A]>;
|
| 2239 |
};
|
| 2240 |
/**
|
| 2241 |
+
* Checks whether any entry in a hashmap meets a specific condition.
|
| 2242 |
+
*
|
| 2243 |
+
* **Example** (Checking for any matching entry)
|
| 2244 |
*
|
|
|
|
| 2245 |
* ```ts
|
| 2246 |
+
* import { HashMap } from "effect"
|
| 2247 |
*
|
| 2248 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2249 |
*
|
|
|
|
| 2251 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2252 |
* ```
|
| 2253 |
*
|
|
|
|
| 2254 |
* @category elements
|
| 2255 |
+
* @since 3.13.0
|
| 2256 |
*/
|
| 2257 |
export declare const some: {
|
| 2258 |
/**
|
| 2259 |
+
* Checks whether any entry in a hashmap meets a specific condition.
|
| 2260 |
+
*
|
| 2261 |
+
* **Example** (Checking for any matching entry)
|
| 2262 |
*
|
|
|
|
| 2263 |
* ```ts
|
| 2264 |
+
* import { HashMap } from "effect"
|
| 2265 |
*
|
| 2266 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2267 |
*
|
|
|
|
| 2269 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2270 |
* ```
|
| 2271 |
*
|
|
|
|
| 2272 |
* @category elements
|
| 2273 |
+
* @since 3.13.0
|
| 2274 |
*/
|
| 2275 |
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => boolean;
|
| 2276 |
/**
|
| 2277 |
+
* Checks whether any entry in a hashmap meets a specific condition.
|
| 2278 |
+
*
|
| 2279 |
+
* **Example** (Checking for any matching entry)
|
| 2280 |
*
|
|
|
|
| 2281 |
* ```ts
|
| 2282 |
+
* import { HashMap } from "effect"
|
| 2283 |
*
|
| 2284 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2285 |
*
|
|
|
|
| 2287 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 2288 |
* ```
|
| 2289 |
*
|
|
|
|
| 2290 |
* @category elements
|
| 2291 |
+
* @since 3.13.0
|
| 2292 |
*/
|
| 2293 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): boolean;
|
| 2294 |
};
|
| 2295 |
/**
|
| 2296 |
+
* Checks whether all entries in a hashmap meets a specific condition.
|
| 2297 |
+
*
|
| 2298 |
+
* **Example** (Checking all entries)
|
| 2299 |
*
|
|
|
|
| 2300 |
* ```ts
|
| 2301 |
+
* import { HashMap } from "effect"
|
| 2302 |
*
|
| 2303 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2304 |
*
|
|
|
|
| 2306 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2307 |
* ```
|
| 2308 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2309 |
* @category elements
|
| 2310 |
+
* @since 3.14.0
|
| 2311 |
*/
|
| 2312 |
export declare const every: {
|
| 2313 |
/**
|
| 2314 |
+
* Checks whether all entries in a hashmap meets a specific condition.
|
| 2315 |
+
*
|
| 2316 |
+
* **Example** (Checking all entries)
|
| 2317 |
*
|
|
|
|
| 2318 |
* ```ts
|
| 2319 |
+
* import { HashMap } from "effect"
|
| 2320 |
*
|
| 2321 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2322 |
*
|
|
|
|
| 2324 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2325 |
* ```
|
| 2326 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2327 |
* @category elements
|
| 2328 |
+
* @since 3.14.0
|
| 2329 |
*/
|
| 2330 |
<K, A>(predicate: (a: NoInfer<A>, k: K) => boolean): (self: HashMap<K, A>) => boolean;
|
| 2331 |
/**
|
| 2332 |
+
* Checks whether all entries in a hashmap meets a specific condition.
|
| 2333 |
+
*
|
| 2334 |
+
* **Example** (Checking all entries)
|
| 2335 |
*
|
|
|
|
| 2336 |
* ```ts
|
| 2337 |
+
* import { HashMap } from "effect"
|
| 2338 |
*
|
| 2339 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 2340 |
*
|
|
|
|
| 2342 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 2343 |
* ```
|
| 2344 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2345 |
* @category elements
|
| 2346 |
+
* @since 3.14.0
|
| 2347 |
*/
|
| 2348 |
<K, A>(self: HashMap<K, A>, predicate: (a: A, k: K) => boolean): boolean;
|
| 2349 |
};
|
.opencode/node_modules/effect/dist/HashMap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashMap.d.ts","sourceRoot":"","sources":["../src/HashMap.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE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;;;;;;;;;OAgBG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAA;CACzD,CAAA;AAEjB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK,EAAE;IAClB;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO,CAAA;IACrF;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAA;CACxD,CAAA"}
|
.opencode/node_modules/effect/dist/HashMap.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 2.0.0
|
| 3 |
*/
|
| 4 |
import * as internal from "./internal/hashMap.js";
|
| 5 |
const TypeId = internal.HashMapTypeId;
|
| 6 |
/**
|
| 7 |
-
* Checks
|
|
|
|
|
|
|
| 8 |
*
|
| 9 |
-
* @example
|
| 10 |
* ```ts
|
| 11 |
-
* import
|
| 12 |
*
|
| 13 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 14 |
* const notMap = { a: 1 }
|
|
@@ -18,48 +27,51 @@ const TypeId = internal.HashMapTypeId;
|
|
| 18 |
* console.log(HashMap.isHashMap(null)) // false
|
| 19 |
* ```
|
| 20 |
*
|
| 21 |
-
* @since 2.0.0
|
| 22 |
* @category refinements
|
|
|
|
| 23 |
*/
|
| 24 |
export const isHashMap = internal.isHashMap;
|
| 25 |
/**
|
| 26 |
* Creates a new empty `HashMap`.
|
| 27 |
*
|
| 28 |
-
*
|
|
|
|
| 29 |
* ```ts
|
| 30 |
-
* import
|
| 31 |
*
|
| 32 |
* const map = HashMap.empty<string, number>()
|
| 33 |
* console.log(HashMap.isEmpty(map)) // true
|
| 34 |
* console.log(HashMap.size(map)) // 0
|
| 35 |
* ```
|
| 36 |
*
|
| 37 |
-
* @since 2.0.0
|
| 38 |
* @category constructors
|
|
|
|
| 39 |
*/
|
| 40 |
export const empty = internal.empty;
|
| 41 |
/**
|
| 42 |
* Constructs a new `HashMap` from an array of key/value pairs.
|
| 43 |
*
|
| 44 |
-
*
|
|
|
|
| 45 |
* ```ts
|
| 46 |
-
* import
|
| 47 |
*
|
| 48 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 49 |
* console.log(HashMap.size(map)) // 3
|
| 50 |
* console.log(HashMap.get(map, "b")) // Option.some(2)
|
| 51 |
* ```
|
| 52 |
*
|
| 53 |
-
* @since 2.0.0
|
| 54 |
* @category constructors
|
|
|
|
| 55 |
*/
|
| 56 |
export const make = internal.make;
|
| 57 |
/**
|
| 58 |
* Creates a new `HashMap` from an iterable collection of key/value pairs.
|
| 59 |
*
|
| 60 |
-
*
|
|
|
|
| 61 |
* ```ts
|
| 62 |
-
* import
|
| 63 |
*
|
| 64 |
* const entries = [["a", 1], ["b", 2], ["c", 3]] as const
|
| 65 |
* const map = HashMap.fromIterable(entries)
|
|
@@ -67,16 +79,17 @@ export const make = internal.make;
|
|
| 67 |
* console.log(HashMap.get(map, "a")) // Option.some(1)
|
| 68 |
* ```
|
| 69 |
*
|
| 70 |
-
* @since 2.0.0
|
| 71 |
* @category constructors
|
|
|
|
| 72 |
*/
|
| 73 |
export const fromIterable = internal.fromIterable;
|
| 74 |
/**
|
| 75 |
-
* Checks
|
|
|
|
|
|
|
| 76 |
*
|
| 77 |
-
* @example
|
| 78 |
* ```ts
|
| 79 |
-
* import
|
| 80 |
*
|
| 81 |
* const emptyMap = HashMap.empty<string, number>()
|
| 82 |
* const nonEmptyMap = HashMap.make(["a", 1])
|
|
@@ -85,17 +98,18 @@ export const fromIterable = internal.fromIterable;
|
|
| 85 |
* console.log(HashMap.isEmpty(nonEmptyMap)) // false
|
| 86 |
* ```
|
| 87 |
*
|
| 88 |
-
* @since 2.0.0
|
| 89 |
* @category elements
|
|
|
|
| 90 |
*/
|
| 91 |
export const isEmpty = internal.isEmpty;
|
| 92 |
/**
|
| 93 |
-
*
|
| 94 |
* internal hashing function.
|
| 95 |
*
|
| 96 |
-
*
|
|
|
|
| 97 |
* ```ts
|
| 98 |
-
* import
|
| 99 |
*
|
| 100 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 101 |
*
|
|
@@ -107,17 +121,17 @@ export const isEmpty = internal.isEmpty;
|
|
| 107 |
* console.log(value) // Option.some(2)
|
| 108 |
* ```
|
| 109 |
*
|
| 110 |
-
* @since 2.0.0
|
| 111 |
* @category elements
|
|
|
|
| 112 |
*/
|
| 113 |
export const get = internal.get;
|
| 114 |
/**
|
| 115 |
-
*
|
|
|
|
|
|
|
| 116 |
*
|
| 117 |
-
* @example
|
| 118 |
* ```ts
|
| 119 |
-
* import { Hash } from "effect"
|
| 120 |
-
* import * as HashMap from "effect/HashMap"
|
| 121 |
*
|
| 122 |
* // Useful when implementing custom equality for complex keys
|
| 123 |
* const userMap = HashMap.make(
|
|
@@ -138,21 +152,28 @@ export const get = internal.get;
|
|
| 138 |
* console.log(notFound) // Option.none()
|
| 139 |
* ```
|
| 140 |
*
|
| 141 |
-
* @since 2.0.0
|
| 142 |
* @category elements
|
|
|
|
| 143 |
*/
|
| 144 |
export const getHash = internal.getHash;
|
| 145 |
/**
|
| 146 |
-
*
|
| 147 |
* internal hashing function.
|
| 148 |
*
|
| 149 |
-
*
|
| 150 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
*
|
| 152 |
-
* @example
|
| 153 |
* ```ts
|
| 154 |
-
* import
|
| 155 |
-
* import * as Option from "effect/Option"
|
| 156 |
*
|
| 157 |
* const config = HashMap.make(
|
| 158 |
* ["api_url", "https://api.example.com"],
|
|
@@ -174,16 +195,17 @@ export const getHash = internal.getHash;
|
|
| 174 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 175 |
* ```
|
| 176 |
*
|
| 177 |
-
* @since 2.0.0
|
| 178 |
* @category unsafe
|
|
|
|
| 179 |
*/
|
| 180 |
export const getUnsafe = internal.getUnsafe;
|
| 181 |
/**
|
| 182 |
-
* Checks
|
|
|
|
|
|
|
| 183 |
*
|
| 184 |
-
* @example
|
| 185 |
* ```ts
|
| 186 |
-
* import
|
| 187 |
*
|
| 188 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 189 |
*
|
|
@@ -195,18 +217,18 @@ export const getUnsafe = internal.getUnsafe;
|
|
| 195 |
* console.log(hasB) // true
|
| 196 |
* ```
|
| 197 |
*
|
| 198 |
-
* @since 2.0.0
|
| 199 |
* @category elements
|
|
|
|
| 200 |
*/
|
| 201 |
export const has = internal.has;
|
| 202 |
/**
|
| 203 |
-
* Checks
|
| 204 |
* hash.
|
| 205 |
*
|
| 206 |
-
*
|
|
|
|
| 207 |
* ```ts
|
| 208 |
-
* import { Hash } from "effect"
|
| 209 |
-
* import * as HashMap from "effect/HashMap"
|
| 210 |
*
|
| 211 |
* // Create a map with case-sensitive keys
|
| 212 |
* const userMap = HashMap.make(
|
|
@@ -218,38 +240,43 @@ export const has = internal.has;
|
|
| 218 |
* const exactHash = Hash.string("Admin")
|
| 219 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 220 |
*
|
| 221 |
-
* //
|
| 222 |
-
*
|
| 223 |
-
*
|
|
|
|
|
|
|
|
|
|
| 224 |
* ```
|
| 225 |
*
|
| 226 |
-
* @since 2.0.0
|
| 227 |
* @category elements
|
|
|
|
| 228 |
*/
|
| 229 |
export const hasHash = internal.hasHash;
|
| 230 |
/**
|
| 231 |
-
* Checks
|
|
|
|
|
|
|
| 232 |
*
|
| 233 |
-
* @example
|
| 234 |
* ```ts
|
| 235 |
-
* import
|
| 236 |
*
|
| 237 |
* const hm = HashMap.make([1, "a"])
|
| 238 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 239 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 240 |
* ```
|
| 241 |
*
|
| 242 |
-
* @since 3.16.0
|
| 243 |
* @category elements
|
|
|
|
| 244 |
*/
|
| 245 |
export const hasBy = internal.hasBy;
|
| 246 |
/**
|
| 247 |
* Sets the specified key to the specified value using the internal hashing
|
| 248 |
* function.
|
| 249 |
*
|
| 250 |
-
*
|
|
|
|
| 251 |
* ```ts
|
| 252 |
-
* import
|
| 253 |
*
|
| 254 |
* const map1 = HashMap.make(["a", 1])
|
| 255 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
@@ -261,48 +288,51 @@ export const hasBy = internal.hasBy;
|
|
| 261 |
* console.log(HashMap.size(map1)) // 1
|
| 262 |
* ```
|
| 263 |
*
|
|
|
|
| 264 |
* @since 2.0.0
|
| 265 |
-
* @category transformations
|
| 266 |
*/
|
| 267 |
export const set = internal.set;
|
| 268 |
/**
|
| 269 |
* Returns an `IterableIterator` of the keys within the `HashMap`.
|
| 270 |
*
|
| 271 |
-
*
|
|
|
|
| 272 |
* ```ts
|
| 273 |
-
* import
|
| 274 |
*
|
| 275 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 276 |
* const keys = Array.from(HashMap.keys(map))
|
| 277 |
* console.log(keys.sort()) // ["a", "b", "c"]
|
| 278 |
* ```
|
| 279 |
*
|
| 280 |
-
* @since 2.0.0
|
| 281 |
* @category getters
|
|
|
|
| 282 |
*/
|
| 283 |
export const keys = internal.keys;
|
| 284 |
/**
|
| 285 |
* Returns an `IterableIterator` of the values within the `HashMap`.
|
| 286 |
*
|
| 287 |
-
*
|
|
|
|
| 288 |
* ```ts
|
| 289 |
-
* import
|
| 290 |
*
|
| 291 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 292 |
* const values = Array.from(HashMap.values(map))
|
| 293 |
* console.log(values.sort()) // [1, 2, 3]
|
| 294 |
* ```
|
| 295 |
*
|
| 296 |
-
* @since 2.0.0
|
| 297 |
* @category getters
|
|
|
|
| 298 |
*/
|
| 299 |
export const values = internal.values;
|
| 300 |
/**
|
| 301 |
* Returns an `Array` of the values within the `HashMap`.
|
| 302 |
*
|
| 303 |
-
*
|
|
|
|
| 304 |
* ```ts
|
| 305 |
-
* import
|
| 306 |
*
|
| 307 |
* const employees = HashMap.make(
|
| 308 |
* ["alice", { department: "engineering", salary: 90000 }],
|
|
@@ -323,16 +353,17 @@ export const values = internal.values;
|
|
| 323 |
* console.log(engineers.length) // 2
|
| 324 |
* ```
|
| 325 |
*
|
| 326 |
-
* @since 3.13.0
|
| 327 |
* @category getters
|
|
|
|
| 328 |
*/
|
| 329 |
export const toValues = self => Array.from(values(self));
|
| 330 |
/**
|
| 331 |
* Returns an `IterableIterator` of the entries within the `HashMap`.
|
| 332 |
*
|
| 333 |
-
*
|
|
|
|
| 334 |
* ```ts
|
| 335 |
-
* import
|
| 336 |
*
|
| 337 |
* // Create a configuration map
|
| 338 |
* const config = HashMap.make(
|
|
@@ -341,32 +372,30 @@ export const toValues = self => Array.from(values(self));
|
|
| 341 |
* ["cache.enabled", "true"]
|
| 342 |
* )
|
| 343 |
*
|
| 344 |
-
* //
|
| 345 |
-
* const
|
|
|
|
|
|
|
| 346 |
*
|
| 347 |
-
*
|
| 348 |
-
*
|
| 349 |
-
* console.log(`Setting ${key} = ${value}`)
|
| 350 |
-
* }
|
| 351 |
-
* // Setting database.host = localhost
|
| 352 |
-
* // Setting database.port = 5432
|
| 353 |
-
* // Setting cache.enabled = true
|
| 354 |
*
|
| 355 |
* // Convert to array when you need all entries at once
|
| 356 |
* const allEntries = Array.from(HashMap.entries(config))
|
| 357 |
* console.log(allEntries.length) // 3
|
| 358 |
* ```
|
| 359 |
*
|
| 360 |
-
* @since 2.0.0
|
| 361 |
* @category getters
|
|
|
|
| 362 |
*/
|
| 363 |
export const entries = internal.entries;
|
| 364 |
/**
|
| 365 |
* Returns an `Array<[K, V]>` of the entries within the `HashMap`.
|
| 366 |
*
|
| 367 |
-
*
|
|
|
|
| 368 |
* ```ts
|
| 369 |
-
* import
|
| 370 |
*
|
| 371 |
* const gameScores = HashMap.make(
|
| 372 |
* ["alice", 1250],
|
|
@@ -389,16 +418,17 @@ export const entries = internal.entries;
|
|
| 389 |
* const sortedMap = HashMap.fromIterable(scoreEntries)
|
| 390 |
* ```
|
| 391 |
*
|
| 392 |
-
* @since 2.0.0
|
| 393 |
* @category getters
|
|
|
|
| 394 |
*/
|
| 395 |
export const toEntries = self => Array.from(entries(self));
|
| 396 |
/**
|
| 397 |
* Returns the number of entries within the `HashMap`.
|
| 398 |
*
|
| 399 |
-
*
|
|
|
|
| 400 |
* ```ts
|
| 401 |
-
* import
|
| 402 |
*
|
| 403 |
* const emptyMap = HashMap.empty<string, number>()
|
| 404 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
@@ -407,16 +437,22 @@ export const toEntries = self => Array.from(entries(self));
|
|
| 407 |
* console.log(HashMap.size(map)) // 3
|
| 408 |
* ```
|
| 409 |
*
|
| 410 |
-
* @since 2.0.0
|
| 411 |
* @category getters
|
|
|
|
| 412 |
*/
|
| 413 |
export const size = internal.size;
|
| 414 |
/**
|
| 415 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
*
|
| 417 |
-
* @example
|
| 418 |
* ```ts
|
| 419 |
-
* import
|
| 420 |
*
|
| 421 |
* const map = HashMap.make(["a", 1])
|
| 422 |
*
|
|
@@ -433,16 +469,17 @@ export const size = internal.size;
|
|
| 433 |
* console.log(HashMap.size(result)) // 2
|
| 434 |
* ```
|
| 435 |
*
|
| 436 |
-
* @since 2.0.0
|
| 437 |
* @category mutations
|
|
|
|
| 438 |
*/
|
| 439 |
export const beginMutation = internal.beginMutation;
|
| 440 |
/**
|
| 441 |
* Marks the `HashMap` as immutable, completing the mutation cycle.
|
| 442 |
*
|
| 443 |
-
*
|
|
|
|
| 444 |
* ```ts
|
| 445 |
-
* import
|
| 446 |
*
|
| 447 |
* // Start with an existing map
|
| 448 |
* const original = HashMap.make(["x", 10], ["y", 20])
|
|
@@ -463,16 +500,23 @@ export const beginMutation = internal.beginMutation;
|
|
| 463 |
* console.log(HashMap.get(final, "z")) // Option.some(30)
|
| 464 |
* ```
|
| 465 |
*
|
| 466 |
-
* @since 2.0.0
|
| 467 |
* @category mutations
|
|
|
|
| 468 |
*/
|
| 469 |
export const endMutation = internal.endMutation;
|
| 470 |
/**
|
| 471 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
*
|
| 473 |
-
* @example
|
| 474 |
* ```ts
|
| 475 |
-
* import
|
| 476 |
*
|
| 477 |
* const map1 = HashMap.make(["a", 1])
|
| 478 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
@@ -482,22 +526,23 @@ export const endMutation = internal.endMutation;
|
|
| 482 |
* // Returns a new HashMap with mutations applied
|
| 483 |
* ```
|
| 484 |
*
|
| 485 |
-
* @since 2.0.0
|
| 486 |
* @category mutations
|
|
|
|
| 487 |
*/
|
| 488 |
export const mutate = internal.mutate;
|
| 489 |
/**
|
| 490 |
-
*
|
| 491 |
-
*
|
| 492 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
*
|
| 494 |
-
*
|
| 495 |
-
* exists, or `None` if no such value exists.
|
| 496 |
*
|
| 497 |
-
* @example
|
| 498 |
* ```ts
|
| 499 |
-
* import
|
| 500 |
-
* import * as Option from "effect/Option"
|
| 501 |
*
|
| 502 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 503 |
*
|
|
@@ -509,25 +554,24 @@ export const mutate = internal.mutate;
|
|
| 509 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 510 |
* ```
|
| 511 |
*
|
|
|
|
| 512 |
* @since 2.0.0
|
| 513 |
-
* @category transformations
|
| 514 |
*/
|
| 515 |
export const modifyAt = internal.modifyAt;
|
| 516 |
/**
|
| 517 |
-
*
|
| 518 |
-
*
|
| 519 |
-
*
|
|
|
|
| 520 |
*
|
| 521 |
-
* The update function
|
| 522 |
-
*
|
|
|
|
| 523 |
*
|
| 524 |
-
*
|
| 525 |
*
|
| 526 |
-
* @example
|
| 527 |
* ```ts
|
| 528 |
-
* import { Hash } from "effect"
|
| 529 |
-
* import * as HashMap from "effect/HashMap"
|
| 530 |
-
* import * as Option from "effect/Option"
|
| 531 |
*
|
| 532 |
* // Useful when working with precomputed hashes for performance
|
| 533 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
@@ -561,16 +605,17 @@ export const modifyAt = internal.modifyAt;
|
|
| 561 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 562 |
* ```
|
| 563 |
*
|
|
|
|
| 564 |
* @since 2.0.0
|
| 565 |
-
* @category transformations
|
| 566 |
*/
|
| 567 |
export const modifyHash = internal.modifyHash;
|
| 568 |
/**
|
| 569 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 570 |
*
|
| 571 |
-
*
|
|
|
|
| 572 |
* ```ts
|
| 573 |
-
* import
|
| 574 |
*
|
| 575 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 576 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
@@ -579,16 +624,22 @@ export const modifyHash = internal.modifyHash;
|
|
| 579 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 580 |
* ```
|
| 581 |
*
|
|
|
|
| 582 |
* @since 2.0.0
|
| 583 |
-
* @category transformations
|
| 584 |
*/
|
| 585 |
export const modify = internal.modify;
|
| 586 |
/**
|
| 587 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
*
|
| 589 |
-
* @example
|
| 590 |
* ```ts
|
| 591 |
-
* import
|
| 592 |
*
|
| 593 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 594 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
@@ -598,17 +649,18 @@ export const modify = internal.modify;
|
|
| 598 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 599 |
* ```
|
| 600 |
*
|
| 601 |
-
* @since 2.0.0
|
| 602 |
* @category combining
|
|
|
|
| 603 |
*/
|
| 604 |
export const union = internal.union;
|
| 605 |
/**
|
| 606 |
-
*
|
| 607 |
* hashing function.
|
| 608 |
*
|
| 609 |
-
*
|
|
|
|
| 610 |
* ```ts
|
| 611 |
-
* import
|
| 612 |
*
|
| 613 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 614 |
* const map2 = HashMap.remove(map1, "b")
|
|
@@ -618,16 +670,17 @@ export const union = internal.union;
|
|
| 618 |
* console.log(HashMap.has(map2, "a")) // true
|
| 619 |
* ```
|
| 620 |
*
|
|
|
|
| 621 |
* @since 2.0.0
|
| 622 |
-
* @category transformations
|
| 623 |
*/
|
| 624 |
export const remove = internal.remove;
|
| 625 |
/**
|
| 626 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 627 |
*
|
| 628 |
-
*
|
|
|
|
| 629 |
* ```ts
|
| 630 |
-
* import
|
| 631 |
*
|
| 632 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 633 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
@@ -637,16 +690,17 @@ export const remove = internal.remove;
|
|
| 637 |
* console.log(HashMap.has(map2, "c")) // true
|
| 638 |
* ```
|
| 639 |
*
|
|
|
|
| 640 |
* @since 2.0.0
|
| 641 |
-
* @category transformations
|
| 642 |
*/
|
| 643 |
export const removeMany = internal.removeMany;
|
| 644 |
/**
|
| 645 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 646 |
*
|
| 647 |
-
*
|
|
|
|
| 648 |
* ```ts
|
| 649 |
-
* import
|
| 650 |
*
|
| 651 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 652 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
@@ -657,16 +711,17 @@ export const removeMany = internal.removeMany;
|
|
| 657 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 658 |
* ```
|
| 659 |
*
|
| 660 |
-
* @
|
| 661 |
-
* @
|
| 662 |
*/
|
| 663 |
export const setMany = internal.setMany;
|
| 664 |
/**
|
| 665 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 666 |
*
|
| 667 |
-
*
|
|
|
|
| 668 |
* ```ts
|
| 669 |
-
* import
|
| 670 |
*
|
| 671 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 672 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
@@ -675,18 +730,21 @@ export const setMany = internal.setMany;
|
|
| 675 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 676 |
* ```
|
| 677 |
*
|
| 678 |
-
* @since 2.0.0
|
| 679 |
* @category mapping
|
|
|
|
| 680 |
*/
|
| 681 |
export const map = internal.map;
|
| 682 |
/**
|
| 683 |
-
*
|
|
|
|
|
|
|
| 684 |
*
|
| 685 |
-
*
|
|
|
|
|
|
|
| 686 |
*
|
| 687 |
-
* @example
|
| 688 |
* ```ts
|
| 689 |
-
* import
|
| 690 |
*
|
| 691 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 692 |
* const map2 = HashMap.flatMap(
|
|
@@ -699,16 +757,17 @@ export const map = internal.map;
|
|
| 699 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 700 |
* ```
|
| 701 |
*
|
| 702 |
-
* @since 2.0.0
|
| 703 |
* @category sequencing
|
|
|
|
| 704 |
*/
|
| 705 |
export const flatMap = internal.flatMap;
|
| 706 |
/**
|
| 707 |
* Applies the specified function to the entries of the `HashMap`.
|
| 708 |
*
|
| 709 |
-
*
|
|
|
|
| 710 |
* ```ts
|
| 711 |
-
* import
|
| 712 |
*
|
| 713 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 714 |
* const collected: Array<[string, number]> = []
|
|
@@ -720,16 +779,17 @@ export const flatMap = internal.flatMap;
|
|
| 720 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 721 |
* ```
|
| 722 |
*
|
| 723 |
-
* @since 2.0.0
|
| 724 |
* @category traversing
|
|
|
|
| 725 |
*/
|
| 726 |
export const forEach = internal.forEach;
|
| 727 |
/**
|
| 728 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 729 |
*
|
| 730 |
-
*
|
|
|
|
| 731 |
* ```ts
|
| 732 |
-
* import
|
| 733 |
*
|
| 734 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 735 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
@@ -737,16 +797,17 @@ export const forEach = internal.forEach;
|
|
| 737 |
* console.log(sum) // 6
|
| 738 |
* ```
|
| 739 |
*
|
| 740 |
-
* @since 2.0.0
|
| 741 |
* @category folding
|
|
|
|
| 742 |
*/
|
| 743 |
export const reduce = internal.reduce;
|
| 744 |
/**
|
| 745 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 746 |
*
|
| 747 |
-
*
|
|
|
|
| 748 |
* ```ts
|
| 749 |
-
* import
|
| 750 |
*
|
| 751 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 752 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
@@ -757,17 +818,17 @@ export const reduce = internal.reduce;
|
|
| 757 |
* console.log(HashMap.has(map2, "a")) // false
|
| 758 |
* ```
|
| 759 |
*
|
| 760 |
-
* @since 2.0.0
|
| 761 |
* @category filtering
|
|
|
|
| 762 |
*/
|
| 763 |
export const filter = internal.filter;
|
| 764 |
/**
|
| 765 |
* Filters out `None` values from a `HashMap` of `Options`s.
|
| 766 |
*
|
| 767 |
-
*
|
|
|
|
| 768 |
* ```ts
|
| 769 |
-
* import
|
| 770 |
-
* import * as Option from "effect/Option"
|
| 771 |
*
|
| 772 |
* const map1 = HashMap.make(
|
| 773 |
* ["a", Option.some(1)],
|
|
@@ -781,18 +842,18 @@ export const filter = internal.filter;
|
|
| 781 |
* console.log(HashMap.has(map2, "b")) // false
|
| 782 |
* ```
|
| 783 |
*
|
| 784 |
-
* @since 2.0.0
|
| 785 |
* @category filtering
|
|
|
|
| 786 |
*/
|
| 787 |
export const compact = internal.compact;
|
| 788 |
/**
|
| 789 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 790 |
* only successful results.
|
| 791 |
*
|
| 792 |
-
*
|
|
|
|
| 793 |
* ```ts
|
| 794 |
-
* import
|
| 795 |
-
* import * as Result from "effect/Result"
|
| 796 |
*
|
| 797 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 798 |
* const map2 = HashMap.filterMap(
|
|
@@ -805,23 +866,23 @@ export const compact = internal.compact;
|
|
| 805 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 806 |
* ```
|
| 807 |
*
|
| 808 |
-
* @since 2.0.0
|
| 809 |
* @category filtering
|
|
|
|
| 810 |
*/
|
| 811 |
export const filterMap = internal.filterMap;
|
| 812 |
/**
|
| 813 |
* Returns the first element that satisfies the specified
|
| 814 |
* predicate, or `None` if no such element exists.
|
| 815 |
*
|
| 816 |
-
*
|
|
|
|
| 817 |
* ```ts
|
| 818 |
-
* import
|
| 819 |
-
* import * as Option from "effect/Option"
|
| 820 |
*
|
| 821 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 822 |
-
* const result = HashMap.findFirst(map, (value) => value > 1)
|
| 823 |
-
* console.log(result) // Option.some(["
|
| 824 |
-
* console.log(Option.getOrElse(result, () => ["", 0])) // ["
|
| 825 |
* ```
|
| 826 |
*
|
| 827 |
* @category elements
|
|
@@ -829,11 +890,12 @@ export const filterMap = internal.filterMap;
|
|
| 829 |
*/
|
| 830 |
export const findFirst = internal.findFirst;
|
| 831 |
/**
|
| 832 |
-
* Checks
|
|
|
|
|
|
|
| 833 |
*
|
| 834 |
-
* @example
|
| 835 |
* ```ts
|
| 836 |
-
* import
|
| 837 |
*
|
| 838 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 839 |
*
|
|
@@ -841,16 +903,17 @@ export const findFirst = internal.findFirst;
|
|
| 841 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 842 |
* ```
|
| 843 |
*
|
| 844 |
-
* @since 3.13.0
|
| 845 |
* @category elements
|
|
|
|
| 846 |
*/
|
| 847 |
export const some = internal.some;
|
| 848 |
/**
|
| 849 |
-
* Checks
|
|
|
|
|
|
|
| 850 |
*
|
| 851 |
-
* @example
|
| 852 |
* ```ts
|
| 853 |
-
* import
|
| 854 |
*
|
| 855 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 856 |
*
|
|
@@ -858,11 +921,8 @@ export const some = internal.some;
|
|
| 858 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 859 |
* ```
|
| 860 |
*
|
| 861 |
-
* @param self - The hashmap to check.
|
| 862 |
-
* @param predicate - The condition to test entries (value, key).
|
| 863 |
-
*
|
| 864 |
-
* @since 3.14.0
|
| 865 |
* @category elements
|
|
|
|
| 866 |
*/
|
| 867 |
export const every = internal.every;
|
| 868 |
//# sourceMappingURL=HashMap.js.map
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Stores key/value entries in an immutable hash map.
|
| 3 |
+
*
|
| 4 |
+
* A `HashMap<Key, Value>` hashes keys and resolves matches with Effect's
|
| 5 |
+
* structural equality rules. Lookup, insertion, removal, and transformation
|
| 6 |
+
* operations return new maps, while temporary mutation helpers support efficient
|
| 7 |
+
* batch updates. This module also includes constructors, iteration, conversion,
|
| 8 |
+
* mapping, filtering, and reducing helpers.
|
| 9 |
+
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
| 12 |
import * as internal from "./internal/hashMap.js";
|
| 13 |
const TypeId = internal.HashMapTypeId;
|
| 14 |
/**
|
| 15 |
+
* Checks whether a value is a HashMap.
|
| 16 |
+
*
|
| 17 |
+
* **Example** (Checking HashMap values)
|
| 18 |
*
|
|
|
|
| 19 |
* ```ts
|
| 20 |
+
* import { HashMap } from "effect"
|
| 21 |
*
|
| 22 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 23 |
* const notMap = { a: 1 }
|
|
|
|
| 27 |
* console.log(HashMap.isHashMap(null)) // false
|
| 28 |
* ```
|
| 29 |
*
|
|
|
|
| 30 |
* @category refinements
|
| 31 |
+
* @since 2.0.0
|
| 32 |
*/
|
| 33 |
export const isHashMap = internal.isHashMap;
|
| 34 |
/**
|
| 35 |
* Creates a new empty `HashMap`.
|
| 36 |
*
|
| 37 |
+
* **Example** (Creating an empty HashMap)
|
| 38 |
+
*
|
| 39 |
* ```ts
|
| 40 |
+
* import { HashMap } from "effect"
|
| 41 |
*
|
| 42 |
* const map = HashMap.empty<string, number>()
|
| 43 |
* console.log(HashMap.isEmpty(map)) // true
|
| 44 |
* console.log(HashMap.size(map)) // 0
|
| 45 |
* ```
|
| 46 |
*
|
|
|
|
| 47 |
* @category constructors
|
| 48 |
+
* @since 2.0.0
|
| 49 |
*/
|
| 50 |
export const empty = internal.empty;
|
| 51 |
/**
|
| 52 |
* Constructs a new `HashMap` from an array of key/value pairs.
|
| 53 |
*
|
| 54 |
+
* **Example** (Creating a HashMap from entries)
|
| 55 |
+
*
|
| 56 |
* ```ts
|
| 57 |
+
* import { HashMap } from "effect"
|
| 58 |
*
|
| 59 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 60 |
* console.log(HashMap.size(map)) // 3
|
| 61 |
* console.log(HashMap.get(map, "b")) // Option.some(2)
|
| 62 |
* ```
|
| 63 |
*
|
|
|
|
| 64 |
* @category constructors
|
| 65 |
+
* @since 2.0.0
|
| 66 |
*/
|
| 67 |
export const make = internal.make;
|
| 68 |
/**
|
| 69 |
* Creates a new `HashMap` from an iterable collection of key/value pairs.
|
| 70 |
*
|
| 71 |
+
* **Example** (Creating a HashMap from an iterable)
|
| 72 |
+
*
|
| 73 |
* ```ts
|
| 74 |
+
* import { HashMap } from "effect"
|
| 75 |
*
|
| 76 |
* const entries = [["a", 1], ["b", 2], ["c", 3]] as const
|
| 77 |
* const map = HashMap.fromIterable(entries)
|
|
|
|
| 79 |
* console.log(HashMap.get(map, "a")) // Option.some(1)
|
| 80 |
* ```
|
| 81 |
*
|
|
|
|
| 82 |
* @category constructors
|
| 83 |
+
* @since 2.0.0
|
| 84 |
*/
|
| 85 |
export const fromIterable = internal.fromIterable;
|
| 86 |
/**
|
| 87 |
+
* Checks whether the `HashMap` contains no entries.
|
| 88 |
+
*
|
| 89 |
+
* **Example** (Checking for empty HashMaps)
|
| 90 |
*
|
|
|
|
| 91 |
* ```ts
|
| 92 |
+
* import { HashMap } from "effect"
|
| 93 |
*
|
| 94 |
* const emptyMap = HashMap.empty<string, number>()
|
| 95 |
* const nonEmptyMap = HashMap.make(["a", 1])
|
|
|
|
| 98 |
* console.log(HashMap.isEmpty(nonEmptyMap)) // false
|
| 99 |
* ```
|
| 100 |
*
|
|
|
|
| 101 |
* @category elements
|
| 102 |
+
* @since 2.0.0
|
| 103 |
*/
|
| 104 |
export const isEmpty = internal.isEmpty;
|
| 105 |
/**
|
| 106 |
+
* Looks up the value for the specified key in the `HashMap` safely using the
|
| 107 |
* internal hashing function.
|
| 108 |
*
|
| 109 |
+
* **Example** (Looking up values)
|
| 110 |
+
*
|
| 111 |
* ```ts
|
| 112 |
+
* import { HashMap } from "effect"
|
| 113 |
*
|
| 114 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 115 |
*
|
|
|
|
| 121 |
* console.log(value) // Option.some(2)
|
| 122 |
* ```
|
| 123 |
*
|
|
|
|
| 124 |
* @category elements
|
| 125 |
+
* @since 2.0.0
|
| 126 |
*/
|
| 127 |
export const get = internal.get;
|
| 128 |
/**
|
| 129 |
+
* Looks up the value for the specified key in the `HashMap` safely using a custom hash.
|
| 130 |
+
*
|
| 131 |
+
* **Example** (Looking up values with a hash)
|
| 132 |
*
|
|
|
|
| 133 |
* ```ts
|
| 134 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 135 |
*
|
| 136 |
* // Useful when implementing custom equality for complex keys
|
| 137 |
* const userMap = HashMap.make(
|
|
|
|
| 152 |
* console.log(notFound) // Option.none()
|
| 153 |
* ```
|
| 154 |
*
|
|
|
|
| 155 |
* @category elements
|
| 156 |
+
* @since 2.0.0
|
| 157 |
*/
|
| 158 |
export const getHash = internal.getHash;
|
| 159 |
/**
|
| 160 |
+
* Looks up the value for the specified key in the `HashMap` unsafely using the
|
| 161 |
* internal hashing function.
|
| 162 |
*
|
| 163 |
+
* **When to use**
|
| 164 |
+
*
|
| 165 |
+
* Use when reading from a `HashMap` by a key known to exist, and throwing is an
|
| 166 |
+
* acceptable programming error for a missing key.
|
| 167 |
+
*
|
| 168 |
+
* **Gotchas**
|
| 169 |
+
*
|
| 170 |
+
* This function throws an error if the key is not found. Use `HashMap.get` for
|
| 171 |
+
* safe access that returns `Option`.
|
| 172 |
+
*
|
| 173 |
+
* **Example** (Unsafely looking up values)
|
| 174 |
*
|
|
|
|
| 175 |
* ```ts
|
| 176 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 177 |
*
|
| 178 |
* const config = HashMap.make(
|
| 179 |
* ["api_url", "https://api.example.com"],
|
|
|
|
| 195 |
* // Error: "HashMap.getUnsafe: key not found"
|
| 196 |
* ```
|
| 197 |
*
|
|
|
|
| 198 |
* @category unsafe
|
| 199 |
+
* @since 4.0.0
|
| 200 |
*/
|
| 201 |
export const getUnsafe = internal.getUnsafe;
|
| 202 |
/**
|
| 203 |
+
* Checks whether the specified key has an entry in the `HashMap`.
|
| 204 |
+
*
|
| 205 |
+
* **Example** (Checking for keys)
|
| 206 |
*
|
|
|
|
| 207 |
* ```ts
|
| 208 |
+
* import { HashMap } from "effect"
|
| 209 |
*
|
| 210 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 211 |
*
|
|
|
|
| 217 |
* console.log(hasB) // true
|
| 218 |
* ```
|
| 219 |
*
|
|
|
|
| 220 |
* @category elements
|
| 221 |
+
* @since 2.0.0
|
| 222 |
*/
|
| 223 |
export const has = internal.has;
|
| 224 |
/**
|
| 225 |
+
* Checks whether the specified key has an entry in the `HashMap` using a custom
|
| 226 |
* hash.
|
| 227 |
*
|
| 228 |
+
* **Example** (Checking keys with a hash)
|
| 229 |
+
*
|
| 230 |
* ```ts
|
| 231 |
+
* import { Hash, HashMap } from "effect"
|
|
|
|
| 232 |
*
|
| 233 |
* // Create a map with case-sensitive keys
|
| 234 |
* const userMap = HashMap.make(
|
|
|
|
| 240 |
* const exactHash = Hash.string("Admin")
|
| 241 |
* console.log(HashMap.hasHash(userMap, "Admin", exactHash)) // true
|
| 242 |
*
|
| 243 |
+
* // A matching hash does not override key equality
|
| 244 |
+
* console.log(HashMap.hasHash(userMap, "admin", exactHash)) // false
|
| 245 |
+
*
|
| 246 |
+
* // A different hash also cannot find the existing key
|
| 247 |
+
* const lowercaseHash = Hash.string("admin")
|
| 248 |
+
* console.log(HashMap.hasHash(userMap, "Admin", lowercaseHash)) // false
|
| 249 |
* ```
|
| 250 |
*
|
|
|
|
| 251 |
* @category elements
|
| 252 |
+
* @since 2.0.0
|
| 253 |
*/
|
| 254 |
export const hasHash = internal.hasHash;
|
| 255 |
/**
|
| 256 |
+
* Checks whether an element matching the given predicate exists in the given `HashMap`.
|
| 257 |
+
*
|
| 258 |
+
* **Example** (Checking entries by predicate)
|
| 259 |
*
|
|
|
|
| 260 |
* ```ts
|
| 261 |
+
* import { HashMap } from "effect"
|
| 262 |
*
|
| 263 |
* const hm = HashMap.make([1, "a"])
|
| 264 |
* HashMap.hasBy(hm, (value, key) => value === "a" && key === 1) // -> true
|
| 265 |
* HashMap.hasBy(hm, (value) => value === "b") // -> false
|
| 266 |
* ```
|
| 267 |
*
|
|
|
|
| 268 |
* @category elements
|
| 269 |
+
* @since 3.16.0
|
| 270 |
*/
|
| 271 |
export const hasBy = internal.hasBy;
|
| 272 |
/**
|
| 273 |
* Sets the specified key to the specified value using the internal hashing
|
| 274 |
* function.
|
| 275 |
*
|
| 276 |
+
* **Example** (Setting a value)
|
| 277 |
+
*
|
| 278 |
* ```ts
|
| 279 |
+
* import { HashMap } from "effect"
|
| 280 |
*
|
| 281 |
* const map1 = HashMap.make(["a", 1])
|
| 282 |
* const map2 = HashMap.set(map1, "b", 2)
|
|
|
|
| 288 |
* console.log(HashMap.size(map1)) // 1
|
| 289 |
* ```
|
| 290 |
*
|
| 291 |
+
* @category transforming
|
| 292 |
* @since 2.0.0
|
|
|
|
| 293 |
*/
|
| 294 |
export const set = internal.set;
|
| 295 |
/**
|
| 296 |
* Returns an `IterableIterator` of the keys within the `HashMap`.
|
| 297 |
*
|
| 298 |
+
* **Example** (Iterating keys)
|
| 299 |
+
*
|
| 300 |
* ```ts
|
| 301 |
+
* import { HashMap } from "effect"
|
| 302 |
*
|
| 303 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 304 |
* const keys = Array.from(HashMap.keys(map))
|
| 305 |
* console.log(keys.sort()) // ["a", "b", "c"]
|
| 306 |
* ```
|
| 307 |
*
|
|
|
|
| 308 |
* @category getters
|
| 309 |
+
* @since 2.0.0
|
| 310 |
*/
|
| 311 |
export const keys = internal.keys;
|
| 312 |
/**
|
| 313 |
* Returns an `IterableIterator` of the values within the `HashMap`.
|
| 314 |
*
|
| 315 |
+
* **Example** (Iterating values)
|
| 316 |
+
*
|
| 317 |
* ```ts
|
| 318 |
+
* import { HashMap } from "effect"
|
| 319 |
*
|
| 320 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 321 |
* const values = Array.from(HashMap.values(map))
|
| 322 |
* console.log(values.sort()) // [1, 2, 3]
|
| 323 |
* ```
|
| 324 |
*
|
|
|
|
| 325 |
* @category getters
|
| 326 |
+
* @since 2.0.0
|
| 327 |
*/
|
| 328 |
export const values = internal.values;
|
| 329 |
/**
|
| 330 |
* Returns an `Array` of the values within the `HashMap`.
|
| 331 |
*
|
| 332 |
+
* **Example** (Converting values to an array)
|
| 333 |
+
*
|
| 334 |
* ```ts
|
| 335 |
+
* import { HashMap } from "effect"
|
| 336 |
*
|
| 337 |
* const employees = HashMap.make(
|
| 338 |
* ["alice", { department: "engineering", salary: 90000 }],
|
|
|
|
| 353 |
* console.log(engineers.length) // 2
|
| 354 |
* ```
|
| 355 |
*
|
|
|
|
| 356 |
* @category getters
|
| 357 |
+
* @since 3.13.0
|
| 358 |
*/
|
| 359 |
export const toValues = self => Array.from(values(self));
|
| 360 |
/**
|
| 361 |
* Returns an `IterableIterator` of the entries within the `HashMap`.
|
| 362 |
*
|
| 363 |
+
* **Example** (Iterating entries)
|
| 364 |
+
*
|
| 365 |
* ```ts
|
| 366 |
+
* import { HashMap } from "effect"
|
| 367 |
*
|
| 368 |
* // Create a configuration map
|
| 369 |
* const config = HashMap.make(
|
|
|
|
| 372 |
* ["cache.enabled", "true"]
|
| 373 |
* )
|
| 374 |
*
|
| 375 |
+
* // Sort the derived array for deterministic output
|
| 376 |
+
* const settings = Array.from(HashMap.entries(config))
|
| 377 |
+
* .sort(([left], [right]) => left.localeCompare(right))
|
| 378 |
+
* .map(([key, value]) => `Setting ${key} = ${value}`)
|
| 379 |
*
|
| 380 |
+
* console.log(settings)
|
| 381 |
+
* // ["Setting cache.enabled = true", "Setting database.host = localhost", "Setting database.port = 5432"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 382 |
*
|
| 383 |
* // Convert to array when you need all entries at once
|
| 384 |
* const allEntries = Array.from(HashMap.entries(config))
|
| 385 |
* console.log(allEntries.length) // 3
|
| 386 |
* ```
|
| 387 |
*
|
|
|
|
| 388 |
* @category getters
|
| 389 |
+
* @since 2.0.0
|
| 390 |
*/
|
| 391 |
export const entries = internal.entries;
|
| 392 |
/**
|
| 393 |
* Returns an `Array<[K, V]>` of the entries within the `HashMap`.
|
| 394 |
*
|
| 395 |
+
* **Example** (Converting entries to an array)
|
| 396 |
+
*
|
| 397 |
* ```ts
|
| 398 |
+
* import { HashMap } from "effect"
|
| 399 |
*
|
| 400 |
* const gameScores = HashMap.make(
|
| 401 |
* ["alice", 1250],
|
|
|
|
| 418 |
* const sortedMap = HashMap.fromIterable(scoreEntries)
|
| 419 |
* ```
|
| 420 |
*
|
|
|
|
| 421 |
* @category getters
|
| 422 |
+
* @since 2.0.0
|
| 423 |
*/
|
| 424 |
export const toEntries = self => Array.from(entries(self));
|
| 425 |
/**
|
| 426 |
* Returns the number of entries within the `HashMap`.
|
| 427 |
*
|
| 428 |
+
* **Example** (Getting the size)
|
| 429 |
+
*
|
| 430 |
* ```ts
|
| 431 |
+
* import { HashMap } from "effect"
|
| 432 |
*
|
| 433 |
* const emptyMap = HashMap.empty<string, number>()
|
| 434 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
|
|
|
| 437 |
* console.log(HashMap.size(map)) // 3
|
| 438 |
* ```
|
| 439 |
*
|
|
|
|
| 440 |
* @category getters
|
| 441 |
+
* @since 2.0.0
|
| 442 |
*/
|
| 443 |
export const size = internal.size;
|
| 444 |
/**
|
| 445 |
+
* Creates a transient mutable `HashMap` for efficient batched updates.
|
| 446 |
+
*
|
| 447 |
+
* **Details**
|
| 448 |
+
*
|
| 449 |
+
* Apply updates to the returned map, then call `endMutation` to finish the
|
| 450 |
+
* mutation window and use the result as an immutable `HashMap`.
|
| 451 |
+
*
|
| 452 |
+
* **Example** (Beginning batch mutation)
|
| 453 |
*
|
|
|
|
| 454 |
* ```ts
|
| 455 |
+
* import { HashMap } from "effect"
|
| 456 |
*
|
| 457 |
* const map = HashMap.make(["a", 1])
|
| 458 |
*
|
|
|
|
| 469 |
* console.log(HashMap.size(result)) // 2
|
| 470 |
* ```
|
| 471 |
*
|
|
|
|
| 472 |
* @category mutations
|
| 473 |
+
* @since 2.0.0
|
| 474 |
*/
|
| 475 |
export const beginMutation = internal.beginMutation;
|
| 476 |
/**
|
| 477 |
* Marks the `HashMap` as immutable, completing the mutation cycle.
|
| 478 |
*
|
| 479 |
+
* **Example** (Ending batch mutation)
|
| 480 |
+
*
|
| 481 |
* ```ts
|
| 482 |
+
* import { HashMap } from "effect"
|
| 483 |
*
|
| 484 |
* // Start with an existing map
|
| 485 |
* const original = HashMap.make(["x", 10], ["y", 20])
|
|
|
|
| 500 |
* console.log(HashMap.get(final, "z")) // Option.some(30)
|
| 501 |
* ```
|
| 502 |
*
|
|
|
|
| 503 |
* @category mutations
|
| 504 |
+
* @since 2.0.0
|
| 505 |
*/
|
| 506 |
export const endMutation = internal.endMutation;
|
| 507 |
/**
|
| 508 |
+
* Runs a batch of updates against a transient mutable copy of the `HashMap`
|
| 509 |
+
* and returns the finalized immutable result.
|
| 510 |
+
*
|
| 511 |
+
* **Details**
|
| 512 |
+
*
|
| 513 |
+
* The callback may call mutation-oriented helpers such as `set` and `remove`
|
| 514 |
+
* on the transient map.
|
| 515 |
+
*
|
| 516 |
+
* **Example** (Applying batched mutations)
|
| 517 |
*
|
|
|
|
| 518 |
* ```ts
|
| 519 |
+
* import { HashMap } from "effect"
|
| 520 |
*
|
| 521 |
* const map1 = HashMap.make(["a", 1])
|
| 522 |
* const map2 = HashMap.mutate(map1, (mutable) => {
|
|
|
|
| 526 |
* // Returns a new HashMap with mutations applied
|
| 527 |
* ```
|
| 528 |
*
|
|
|
|
| 529 |
* @category mutations
|
| 530 |
+
* @since 2.0.0
|
| 531 |
*/
|
| 532 |
export const mutate = internal.mutate;
|
| 533 |
/**
|
| 534 |
+
* Sets or removes the specified key using an update function.
|
| 535 |
+
*
|
| 536 |
+
* **Details**
|
| 537 |
+
*
|
| 538 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 539 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 540 |
+
* `None` removes the key or leaves it absent.
|
| 541 |
*
|
| 542 |
+
* **Example** (Updating values with Options)
|
|
|
|
| 543 |
*
|
|
|
|
| 544 |
* ```ts
|
| 545 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 546 |
*
|
| 547 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 548 |
*
|
|
|
|
| 554 |
* console.log(HashMap.get(updated, "a")) // Option.some(2)
|
| 555 |
* ```
|
| 556 |
*
|
| 557 |
+
* @category transforming
|
| 558 |
* @since 2.0.0
|
|
|
|
| 559 |
*/
|
| 560 |
export const modifyAt = internal.modifyAt;
|
| 561 |
/**
|
| 562 |
+
* Sets or removes the specified key using a precomputed hash and an update
|
| 563 |
+
* function.
|
| 564 |
+
*
|
| 565 |
+
* **Details**
|
| 566 |
*
|
| 567 |
+
* The update function receives `Some(value)` when the key exists or `None`
|
| 568 |
+
* when it does not. Returning `Some(newValue)` stores the value, and returning
|
| 569 |
+
* `None` removes the key or leaves it absent.
|
| 570 |
*
|
| 571 |
+
* **Example** (Updating values with a hash)
|
| 572 |
*
|
|
|
|
| 573 |
* ```ts
|
| 574 |
+
* import { Hash, HashMap, Option } from "effect"
|
|
|
|
|
|
|
| 575 |
*
|
| 576 |
* // Useful when working with precomputed hashes for performance
|
| 577 |
* const counters = HashMap.make(["downloads", 100], ["views", 250])
|
|
|
|
| 605 |
* console.log(HashMap.get(withClicks, "clicks")) // Option.some(1)
|
| 606 |
* ```
|
| 607 |
*
|
| 608 |
+
* @category transforming
|
| 609 |
* @since 2.0.0
|
|
|
|
| 610 |
*/
|
| 611 |
export const modifyHash = internal.modifyHash;
|
| 612 |
/**
|
| 613 |
* Updates the value of the specified key within the `HashMap` if it exists.
|
| 614 |
*
|
| 615 |
+
* **Example** (Modifying existing values)
|
| 616 |
+
*
|
| 617 |
* ```ts
|
| 618 |
+
* import { HashMap } from "effect"
|
| 619 |
*
|
| 620 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 621 |
* const map2 = HashMap.modify(map1, "a", (value) => value * 3)
|
|
|
|
| 624 |
* console.log(HashMap.get(map2, "b")) // Option.some(2)
|
| 625 |
* ```
|
| 626 |
*
|
| 627 |
+
* @category transforming
|
| 628 |
* @since 2.0.0
|
|
|
|
| 629 |
*/
|
| 630 |
export const modify = internal.modify;
|
| 631 |
/**
|
| 632 |
+
* Combines two `HashMap`s into one.
|
| 633 |
+
*
|
| 634 |
+
* **Details**
|
| 635 |
+
*
|
| 636 |
+
* Entries from `that` are inserted into `self`; when both maps contain an
|
| 637 |
+
* equal key, the value from `that` replaces the value from `self`.
|
| 638 |
+
*
|
| 639 |
+
* **Example** (Combining HashMaps)
|
| 640 |
*
|
|
|
|
| 641 |
* ```ts
|
| 642 |
+
* import { HashMap } from "effect"
|
| 643 |
*
|
| 644 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 645 |
* const map2 = HashMap.make(["b", 20], ["c", 3])
|
|
|
|
| 649 |
* console.log(HashMap.get(union, "b")) // Option.some(20) - map2 wins
|
| 650 |
* ```
|
| 651 |
*
|
|
|
|
| 652 |
* @category combining
|
| 653 |
+
* @since 2.0.0
|
| 654 |
*/
|
| 655 |
export const union = internal.union;
|
| 656 |
/**
|
| 657 |
+
* Removes the entry for the specified key in the `HashMap` using the internal
|
| 658 |
* hashing function.
|
| 659 |
*
|
| 660 |
+
* **Example** (Removing a key)
|
| 661 |
+
*
|
| 662 |
* ```ts
|
| 663 |
+
* import { HashMap } from "effect"
|
| 664 |
*
|
| 665 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 666 |
* const map2 = HashMap.remove(map1, "b")
|
|
|
|
| 670 |
* console.log(HashMap.has(map2, "a")) // true
|
| 671 |
* ```
|
| 672 |
*
|
| 673 |
+
* @category transforming
|
| 674 |
* @since 2.0.0
|
|
|
|
| 675 |
*/
|
| 676 |
export const remove = internal.remove;
|
| 677 |
/**
|
| 678 |
* Removes all entries in the `HashMap` which have the specified keys.
|
| 679 |
*
|
| 680 |
+
* **Example** (Removing multiple keys)
|
| 681 |
+
*
|
| 682 |
* ```ts
|
| 683 |
+
* import { HashMap } from "effect"
|
| 684 |
*
|
| 685 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 686 |
* const map2 = HashMap.removeMany(map1, ["b", "d"])
|
|
|
|
| 690 |
* console.log(HashMap.has(map2, "c")) // true
|
| 691 |
* ```
|
| 692 |
*
|
| 693 |
+
* @category transforming
|
| 694 |
* @since 2.0.0
|
|
|
|
| 695 |
*/
|
| 696 |
export const removeMany = internal.removeMany;
|
| 697 |
/**
|
| 698 |
* Sets multiple key-value pairs in the `HashMap`.
|
| 699 |
*
|
| 700 |
+
* **Example** (Setting multiple entries)
|
| 701 |
+
*
|
| 702 |
* ```ts
|
| 703 |
+
* import { HashMap } from "effect"
|
| 704 |
*
|
| 705 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 706 |
* const newEntries = [["c", 3], ["d", 4], ["a", 10]] as const // "a" will be overwritten
|
|
|
|
| 711 |
* console.log(HashMap.get(map2, "c")) // Option.some(3)
|
| 712 |
* ```
|
| 713 |
*
|
| 714 |
+
* @category transforming
|
| 715 |
+
* @since 4.0.0
|
| 716 |
*/
|
| 717 |
export const setMany = internal.setMany;
|
| 718 |
/**
|
| 719 |
* Maps over the entries of the `HashMap` using the specified function.
|
| 720 |
*
|
| 721 |
+
* **Example** (Mapping values)
|
| 722 |
+
*
|
| 723 |
* ```ts
|
| 724 |
+
* import { HashMap } from "effect"
|
| 725 |
*
|
| 726 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 727 |
* const map2 = HashMap.map(map1, (value, key) => `${key}:${value * 2}`)
|
|
|
|
| 730 |
* console.log(HashMap.get(map2, "b")) // Option.some("b:4")
|
| 731 |
* ```
|
| 732 |
*
|
|
|
|
| 733 |
* @category mapping
|
| 734 |
+
* @since 2.0.0
|
| 735 |
*/
|
| 736 |
export const map = internal.map;
|
| 737 |
/**
|
| 738 |
+
* Maps each entry to a `HashMap` and flattens the results.
|
| 739 |
+
*
|
| 740 |
+
* **Gotchas**
|
| 741 |
*
|
| 742 |
+
* The hash and equality behavior of both maps have to be the same.
|
| 743 |
+
*
|
| 744 |
+
* **Example** (FlatMapping values)
|
| 745 |
*
|
|
|
|
| 746 |
* ```ts
|
| 747 |
+
* import { HashMap } from "effect"
|
| 748 |
*
|
| 749 |
* const map1 = HashMap.make(["a", 1], ["b", 2])
|
| 750 |
* const map2 = HashMap.flatMap(
|
|
|
|
| 757 |
* console.log(HashMap.get(map2, "b2")) // Option.some(4)
|
| 758 |
* ```
|
| 759 |
*
|
|
|
|
| 760 |
* @category sequencing
|
| 761 |
+
* @since 2.0.0
|
| 762 |
*/
|
| 763 |
export const flatMap = internal.flatMap;
|
| 764 |
/**
|
| 765 |
* Applies the specified function to the entries of the `HashMap`.
|
| 766 |
*
|
| 767 |
+
* **Example** (Iterating with side effects)
|
| 768 |
+
*
|
| 769 |
* ```ts
|
| 770 |
+
* import { HashMap } from "effect"
|
| 771 |
*
|
| 772 |
* const map = HashMap.make(["a", 1], ["b", 2])
|
| 773 |
* const collected: Array<[string, number]> = []
|
|
|
|
| 779 |
* console.log(collected.sort()) // [["a", 1], ["b", 2]]
|
| 780 |
* ```
|
| 781 |
*
|
|
|
|
| 782 |
* @category traversing
|
| 783 |
+
* @since 2.0.0
|
| 784 |
*/
|
| 785 |
export const forEach = internal.forEach;
|
| 786 |
/**
|
| 787 |
* Reduces the specified state over the entries of the `HashMap`.
|
| 788 |
*
|
| 789 |
+
* **Example** (Reducing values)
|
| 790 |
+
*
|
| 791 |
* ```ts
|
| 792 |
+
* import { HashMap } from "effect"
|
| 793 |
*
|
| 794 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 795 |
* const sum = HashMap.reduce(map, 0, (acc, value) => acc + value)
|
|
|
|
| 797 |
* console.log(sum) // 6
|
| 798 |
* ```
|
| 799 |
*
|
|
|
|
| 800 |
* @category folding
|
| 801 |
+
* @since 2.0.0
|
| 802 |
*/
|
| 803 |
export const reduce = internal.reduce;
|
| 804 |
/**
|
| 805 |
* Filters entries out of a `HashMap` using the specified predicate.
|
| 806 |
*
|
| 807 |
+
* **Example** (Filtering entries)
|
| 808 |
+
*
|
| 809 |
* ```ts
|
| 810 |
+
* import { HashMap } from "effect"
|
| 811 |
*
|
| 812 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 813 |
* const map2 = HashMap.filter(map1, (value) => value % 2 === 0)
|
|
|
|
| 818 |
* console.log(HashMap.has(map2, "a")) // false
|
| 819 |
* ```
|
| 820 |
*
|
|
|
|
| 821 |
* @category filtering
|
| 822 |
+
* @since 2.0.0
|
| 823 |
*/
|
| 824 |
export const filter = internal.filter;
|
| 825 |
/**
|
| 826 |
* Filters out `None` values from a `HashMap` of `Options`s.
|
| 827 |
*
|
| 828 |
+
* **Example** (Compacting Option values)
|
| 829 |
+
*
|
| 830 |
* ```ts
|
| 831 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 832 |
*
|
| 833 |
* const map1 = HashMap.make(
|
| 834 |
* ["a", Option.some(1)],
|
|
|
|
| 842 |
* console.log(HashMap.has(map2, "b")) // false
|
| 843 |
* ```
|
| 844 |
*
|
|
|
|
| 845 |
* @category filtering
|
| 846 |
+
* @since 2.0.0
|
| 847 |
*/
|
| 848 |
export const compact = internal.compact;
|
| 849 |
/**
|
| 850 |
* Maps over the entries of the `HashMap` using the specified filter and keeps
|
| 851 |
* only successful results.
|
| 852 |
*
|
| 853 |
+
* **Example** (Filtering and mapping Results)
|
| 854 |
+
*
|
| 855 |
* ```ts
|
| 856 |
+
* import { HashMap, Result } from "effect"
|
|
|
|
| 857 |
*
|
| 858 |
* const map1 = HashMap.make(["a", 1], ["b", 2], ["c", 3], ["d", 4])
|
| 859 |
* const map2 = HashMap.filterMap(
|
|
|
|
| 866 |
* console.log(HashMap.get(map2, "d")) // Option.some(8)
|
| 867 |
* ```
|
| 868 |
*
|
|
|
|
| 869 |
* @category filtering
|
| 870 |
+
* @since 2.0.0
|
| 871 |
*/
|
| 872 |
export const filterMap = internal.filterMap;
|
| 873 |
/**
|
| 874 |
* Returns the first element that satisfies the specified
|
| 875 |
* predicate, or `None` if no such element exists.
|
| 876 |
*
|
| 877 |
+
* **Example** (Finding the first matching entry)
|
| 878 |
+
*
|
| 879 |
* ```ts
|
| 880 |
+
* import { HashMap, Option } from "effect"
|
|
|
|
| 881 |
*
|
| 882 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 883 |
+
* const result = HashMap.findFirst(map, (value, key) => key === "b" && value > 1)
|
| 884 |
+
* console.log(result) // Option.some(["b", 2])
|
| 885 |
+
* console.log(Option.getOrElse(result, () => ["", 0])) // ["b", 2]
|
| 886 |
* ```
|
| 887 |
*
|
| 888 |
* @category elements
|
|
|
|
| 890 |
*/
|
| 891 |
export const findFirst = internal.findFirst;
|
| 892 |
/**
|
| 893 |
+
* Checks whether any entry in a hashmap meets a specific condition.
|
| 894 |
+
*
|
| 895 |
+
* **Example** (Checking for any matching entry)
|
| 896 |
*
|
|
|
|
| 897 |
* ```ts
|
| 898 |
+
* import { HashMap } from "effect"
|
| 899 |
*
|
| 900 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 901 |
*
|
|
|
|
| 903 |
* console.log(HashMap.some(map, (value) => value > 5)) // false
|
| 904 |
* ```
|
| 905 |
*
|
|
|
|
| 906 |
* @category elements
|
| 907 |
+
* @since 3.13.0
|
| 908 |
*/
|
| 909 |
export const some = internal.some;
|
| 910 |
/**
|
| 911 |
+
* Checks whether all entries in a hashmap meets a specific condition.
|
| 912 |
+
*
|
| 913 |
+
* **Example** (Checking all entries)
|
| 914 |
*
|
|
|
|
| 915 |
* ```ts
|
| 916 |
+
* import { HashMap } from "effect"
|
| 917 |
*
|
| 918 |
* const map = HashMap.make(["a", 1], ["b", 2], ["c", 3])
|
| 919 |
*
|
|
|
|
| 921 |
* console.log(HashMap.every(map, (value) => value > 1)) // false
|
| 922 |
* ```
|
| 923 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 924 |
* @category elements
|
| 925 |
+
* @since 3.14.0
|
| 926 |
*/
|
| 927 |
export const every = internal.every;
|
| 928 |
//# sourceMappingURL=HashMap.js.map
|
.opencode/node_modules/effect/dist/HashMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashMap.js","names":["internal","TypeId","HashMapTypeId","isHashMap","empty","make","fromIterable","isEmpty","get","getHash","getUnsafe","has","hasHash","hasBy","set","keys","values","toValues","self","Array","from","entries","toEntries","size","beginMutation","endMutation","mutate","modifyAt","modifyHash","modify","union","remove","removeMany","setMany","map","flatMap","forEach","reduce","filter","compact","filterMap","findFirst","some","every"],"sources":["../src/HashMap.ts"],"sourcesContent":[null],"mappings":"AAAA;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"HashMap.js","names":["internal","TypeId","HashMapTypeId","isHashMap","empty","make","fromIterable","isEmpty","get","getHash","getUnsafe","has","hasHash","hasBy","set","keys","values","toValues","self","Array","from","entries","toEntries","size","beginMutation","endMutation","mutate","modifyAt","modifyHash","modify","union","remove","removeMany","setMany","map","flatMap","forEach","reduce","filter","compact","filterMap","findFirst","some","every"],"sources":["../src/HashMap.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAcA,OAAO,KAAKA,QAAQ,MAAM,uBAAuB;AAMjD,MAAMC,MAAM,GAAGD,QAAQ,CAACE,aAAa;AAyLrC;;;;;;;;;;;;;;;;;;;AAmBA,OAA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BA,OAAO,MAAMC,UAAU,GAyCnBhC,QAAQ,CAACgC,UAAU;AAEvB;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMC,OAAO,GA2ChBjC,QAAQ,CAACiC,OAAO;AAEpB;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,GAAG,GAuCZlC,QAAQ,CAACkC,GAAG;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,OAAO,MAAMC,OAAO,GAuDhBnC,QAAQ,CAACmC,OAAO;AAEpB;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,OAAO,GA6ChBpC,QAAQ,CAACoC,OAAO;AAEpB;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,MAAM,GAqCfrC,QAAQ,CAACqC,MAAM;AAEnB;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMC,MAAM,GA2CftC,QAAQ,CAACsC,MAAM;AAEnB;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAO,MAAMC,OAAO,GAAyDvC,QAAQ,CAACuC,OAAO;AAE7F;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAO,MAAMC,SAAS,GAiDlBxC,QAAQ,CAACwC,SAAS;AAEtB;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,SAAS,GAuClBzC,QAAQ,CAACyC,SAAS;AAEtB;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,IAAI,GAqCb1C,QAAQ,CAAC0C,IAAI;AAEjB;;;;;;;;;;;;;;;;;AAiBA,OAAO,MAAMC,KAAK,GAqCd3C,QAAQ,CAAC2C,KAAK","ignoreList":[]}
|
.opencode/node_modules/effect/dist/HashRing.d.ts
CHANGED
|
@@ -2,8 +2,21 @@ import type { Pipeable } from "./Pipeable.ts";
|
|
| 2 |
import * as PrimaryKey from "./PrimaryKey.ts";
|
| 3 |
declare const TypeId: "~effect/cluster/HashRing";
|
| 4 |
/**
|
| 5 |
-
*
|
| 6 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
*/
|
| 8 |
export interface HashRing<A extends PrimaryKey.PrimaryKey> extends Pipeable, Iterable<A> {
|
| 9 |
readonly [TypeId]: typeof TypeId;
|
|
@@ -13,70 +26,171 @@ export interface HashRing<A extends PrimaryKey.PrimaryKey> extends Pipeable, Ite
|
|
| 13 |
ring: Array<[hash: number, node: string]>;
|
| 14 |
}
|
| 15 |
/**
|
| 16 |
-
*
|
| 17 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
*/
|
| 19 |
export declare const isHashRing: (u: unknown) => u is HashRing<any>;
|
| 20 |
/**
|
| 21 |
-
*
|
| 22 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
*/
|
| 24 |
export declare const make: <A extends PrimaryKey.PrimaryKey>(options?: {
|
| 25 |
readonly baseWeight?: number | undefined;
|
| 26 |
}) => HashRing<A>;
|
| 27 |
/**
|
| 28 |
-
*
|
| 29 |
* will be updated. For example, you can use this to update the node's weight.
|
| 30 |
*
|
| 31 |
-
*
|
| 32 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*/
|
| 34 |
export declare const addMany: {
|
| 35 |
/**
|
| 36 |
-
*
|
| 37 |
* will be updated. For example, you can use this to update the node's weight.
|
| 38 |
*
|
| 39 |
-
*
|
| 40 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
*/
|
| 42 |
<A extends PrimaryKey.PrimaryKey>(nodes: Iterable<A>, options?: {
|
| 43 |
readonly weight?: number | undefined;
|
| 44 |
}): (self: HashRing<A>) => HashRing<A>;
|
| 45 |
/**
|
| 46 |
-
*
|
| 47 |
* will be updated. For example, you can use this to update the node's weight.
|
| 48 |
*
|
| 49 |
-
*
|
| 50 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
*/
|
| 52 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, nodes: Iterable<A>, options?: {
|
| 53 |
readonly weight?: number | undefined;
|
| 54 |
}): HashRing<A>;
|
| 55 |
};
|
| 56 |
/**
|
| 57 |
-
*
|
| 58 |
* will be updated. For example, you can use this to update the node's weight.
|
| 59 |
*
|
| 60 |
-
*
|
| 61 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
*/
|
| 63 |
export declare const add: {
|
| 64 |
/**
|
| 65 |
-
*
|
| 66 |
* will be updated. For example, you can use this to update the node's weight.
|
| 67 |
*
|
| 68 |
-
*
|
| 69 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
*/
|
| 71 |
<A extends PrimaryKey.PrimaryKey>(node: A, options?: {
|
| 72 |
readonly weight?: number | undefined;
|
| 73 |
}): (self: HashRing<A>) => HashRing<A>;
|
| 74 |
/**
|
| 75 |
-
*
|
| 76 |
* will be updated. For example, you can use this to update the node's weight.
|
| 77 |
*
|
| 78 |
-
*
|
| 79 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
*/
|
| 81 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A, options?: {
|
| 82 |
readonly weight?: number | undefined;
|
|
@@ -85,38 +199,137 @@ export declare const add: {
|
|
| 85 |
/**
|
| 86 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 87 |
*
|
| 88 |
-
*
|
| 89 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
*/
|
| 91 |
export declare const remove: {
|
| 92 |
/**
|
| 93 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 94 |
*
|
| 95 |
-
*
|
| 96 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
*/
|
| 98 |
<A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => HashRing<A>;
|
| 99 |
/**
|
| 100 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 101 |
*
|
| 102 |
-
*
|
| 103 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
*/
|
| 105 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): HashRing<A>;
|
| 106 |
};
|
| 107 |
/**
|
| 108 |
-
*
|
| 109 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
*/
|
| 111 |
export declare const has: {
|
| 112 |
/**
|
| 113 |
-
*
|
| 114 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
*/
|
| 116 |
<A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => boolean;
|
| 117 |
/**
|
| 118 |
-
*
|
| 119 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
*/
|
| 121 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): boolean;
|
| 122 |
};
|
|
@@ -124,17 +337,28 @@ export declare const has: {
|
|
| 124 |
* Gets the node which should handle the given input. Returns undefined if
|
| 125 |
* the hashring has no elements with weight.
|
| 126 |
*
|
| 127 |
-
*
|
| 128 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
*/
|
| 130 |
export declare const get: <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, input: string) => A | undefined;
|
| 131 |
/**
|
| 132 |
-
*
|
| 133 |
-
*
|
| 134 |
-
*
|
|
|
|
|
|
|
|
|
|
| 135 |
*
|
| 136 |
-
* @
|
| 137 |
-
* @
|
| 138 |
*/
|
| 139 |
export declare const getShards: <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, count: number) => Array<A> | undefined;
|
| 140 |
export {};
|
|
|
|
| 2 |
import * as PrimaryKey from "./PrimaryKey.ts";
|
| 3 |
declare const TypeId: "~effect/cluster/HashRing";
|
| 4 |
/**
|
| 5 |
+
* A weighted consistent-hashing ring for assigning inputs to nodes with stable
|
| 6 |
+
* remapping as nodes are added or removed.
|
| 7 |
+
*
|
| 8 |
+
* **When to use**
|
| 9 |
+
*
|
| 10 |
+
* Use to maintain a mutable weighted hash ring for routing keys or shards to
|
| 11 |
+
* nodes identified by `PrimaryKey`.
|
| 12 |
+
*
|
| 13 |
+
* **Details**
|
| 14 |
+
*
|
| 15 |
+
* Nodes are identified by their `PrimaryKey` value and can be iterated from the
|
| 16 |
+
* ring.
|
| 17 |
+
*
|
| 18 |
+
* @category models
|
| 19 |
+
* @since 3.19.0
|
| 20 |
*/
|
| 21 |
export interface HashRing<A extends PrimaryKey.PrimaryKey> extends Pipeable, Iterable<A> {
|
| 22 |
readonly [TypeId]: typeof TypeId;
|
|
|
|
| 26 |
ring: Array<[hash: number, node: string]>;
|
| 27 |
}
|
| 28 |
/**
|
| 29 |
+
* Checks whether a value is a `HashRing`.
|
| 30 |
+
*
|
| 31 |
+
* **When to use**
|
| 32 |
+
*
|
| 33 |
+
* Use to narrow an `unknown` value before treating it as a `HashRing`, such as
|
| 34 |
+
* values crossing an untyped boundary.
|
| 35 |
+
*
|
| 36 |
+
* **Details**
|
| 37 |
+
*
|
| 38 |
+
* The guard checks for the module's internal `TypeId` property and narrows to
|
| 39 |
+
* `HashRing<any>`.
|
| 40 |
+
*
|
| 41 |
+
* **Gotchas**
|
| 42 |
+
*
|
| 43 |
+
* This is a structural type-id check; it does not validate the ring's `nodes`,
|
| 44 |
+
* `ring`, or weight state.
|
| 45 |
+
*
|
| 46 |
+
* @see {@link HashRing} for the type narrowed by this guard
|
| 47 |
+
* @see {@link make} for creating an empty `HashRing`
|
| 48 |
+
*
|
| 49 |
+
* @category guards
|
| 50 |
+
* @since 3.19.0
|
| 51 |
*/
|
| 52 |
export declare const isHashRing: (u: unknown) => u is HashRing<any>;
|
| 53 |
/**
|
| 54 |
+
* Creates an empty `HashRing`.
|
| 55 |
+
*
|
| 56 |
+
* **When to use**
|
| 57 |
+
*
|
| 58 |
+
* Use to create an empty weighted consistent-hashing ring with the default or
|
| 59 |
+
* custom virtual-point density.
|
| 60 |
+
*
|
| 61 |
+
* **Details**
|
| 62 |
+
*
|
| 63 |
+
* `baseWeight` controls how many virtual points are added for a node with
|
| 64 |
+
* weight `1`; it defaults to `128` and is clamped to at least `1`.
|
| 65 |
+
*
|
| 66 |
+
* @see {@link add} for registering one node after creation
|
| 67 |
+
* @see {@link addMany} for registering several nodes after creation
|
| 68 |
+
*
|
| 69 |
+
* @category constructors
|
| 70 |
+
* @since 3.19.0
|
| 71 |
*/
|
| 72 |
export declare const make: <A extends PrimaryKey.PrimaryKey>(options?: {
|
| 73 |
readonly baseWeight?: number | undefined;
|
| 74 |
}) => HashRing<A>;
|
| 75 |
/**
|
| 76 |
+
* Adds new nodes to the ring. If a node already exists in the ring, it
|
| 77 |
* will be updated. For example, you can use this to update the node's weight.
|
| 78 |
*
|
| 79 |
+
* **When to use**
|
| 80 |
+
*
|
| 81 |
+
* Use to register or update several nodes in a `HashRing` at the same weight.
|
| 82 |
+
*
|
| 83 |
+
* @category combinators
|
| 84 |
+
* @since 3.19.0
|
| 85 |
*/
|
| 86 |
export declare const addMany: {
|
| 87 |
/**
|
| 88 |
+
* Adds new nodes to the ring. If a node already exists in the ring, it
|
| 89 |
* will be updated. For example, you can use this to update the node's weight.
|
| 90 |
*
|
| 91 |
+
* **When to use**
|
| 92 |
+
*
|
| 93 |
+
* Use to register or update several nodes in a `HashRing` at the same weight.
|
| 94 |
+
*
|
| 95 |
+
* @category combinators
|
| 96 |
+
* @since 3.19.0
|
| 97 |
*/
|
| 98 |
<A extends PrimaryKey.PrimaryKey>(nodes: Iterable<A>, options?: {
|
| 99 |
readonly weight?: number | undefined;
|
| 100 |
}): (self: HashRing<A>) => HashRing<A>;
|
| 101 |
/**
|
| 102 |
+
* Adds new nodes to the ring. If a node already exists in the ring, it
|
| 103 |
* will be updated. For example, you can use this to update the node's weight.
|
| 104 |
*
|
| 105 |
+
* **When to use**
|
| 106 |
+
*
|
| 107 |
+
* Use to register or update several nodes in a `HashRing` at the same weight.
|
| 108 |
+
*
|
| 109 |
+
* @category combinators
|
| 110 |
+
* @since 3.19.0
|
| 111 |
*/
|
| 112 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, nodes: Iterable<A>, options?: {
|
| 113 |
readonly weight?: number | undefined;
|
| 114 |
}): HashRing<A>;
|
| 115 |
};
|
| 116 |
/**
|
| 117 |
+
* Adds a new node to the ring. If the node already exists in the ring, it
|
| 118 |
* will be updated. For example, you can use this to update the node's weight.
|
| 119 |
*
|
| 120 |
+
* **When to use**
|
| 121 |
+
*
|
| 122 |
+
* Use to register one node in a `HashRing` so lookups and shard assignments can
|
| 123 |
+
* return it, or update that node's weight.
|
| 124 |
+
*
|
| 125 |
+
* **Details**
|
| 126 |
+
*
|
| 127 |
+
* Nodes are matched by `PrimaryKey.value`. The weight defaults to `1` and is
|
| 128 |
+
* clamped to at least `0.1`.
|
| 129 |
+
*
|
| 130 |
+
* **Gotchas**
|
| 131 |
+
*
|
| 132 |
+
* This mutates and returns the same ring instance.
|
| 133 |
+
*
|
| 134 |
+
* @see {@link addMany} for adding or updating several nodes
|
| 135 |
+
* @see {@link remove} for unregistering a node
|
| 136 |
+
* @see {@link has} for checking primary-key membership
|
| 137 |
+
*
|
| 138 |
+
* @category combinators
|
| 139 |
+
* @since 3.19.0
|
| 140 |
*/
|
| 141 |
export declare const add: {
|
| 142 |
/**
|
| 143 |
+
* Adds a new node to the ring. If the node already exists in the ring, it
|
| 144 |
* will be updated. For example, you can use this to update the node's weight.
|
| 145 |
*
|
| 146 |
+
* **When to use**
|
| 147 |
+
*
|
| 148 |
+
* Use to register one node in a `HashRing` so lookups and shard assignments can
|
| 149 |
+
* return it, or update that node's weight.
|
| 150 |
+
*
|
| 151 |
+
* **Details**
|
| 152 |
+
*
|
| 153 |
+
* Nodes are matched by `PrimaryKey.value`. The weight defaults to `1` and is
|
| 154 |
+
* clamped to at least `0.1`.
|
| 155 |
+
*
|
| 156 |
+
* **Gotchas**
|
| 157 |
+
*
|
| 158 |
+
* This mutates and returns the same ring instance.
|
| 159 |
+
*
|
| 160 |
+
* @see {@link addMany} for adding or updating several nodes
|
| 161 |
+
* @see {@link remove} for unregistering a node
|
| 162 |
+
* @see {@link has} for checking primary-key membership
|
| 163 |
+
*
|
| 164 |
+
* @category combinators
|
| 165 |
+
* @since 3.19.0
|
| 166 |
*/
|
| 167 |
<A extends PrimaryKey.PrimaryKey>(node: A, options?: {
|
| 168 |
readonly weight?: number | undefined;
|
| 169 |
}): (self: HashRing<A>) => HashRing<A>;
|
| 170 |
/**
|
| 171 |
+
* Adds a new node to the ring. If the node already exists in the ring, it
|
| 172 |
* will be updated. For example, you can use this to update the node's weight.
|
| 173 |
*
|
| 174 |
+
* **When to use**
|
| 175 |
+
*
|
| 176 |
+
* Use to register one node in a `HashRing` so lookups and shard assignments can
|
| 177 |
+
* return it, or update that node's weight.
|
| 178 |
+
*
|
| 179 |
+
* **Details**
|
| 180 |
+
*
|
| 181 |
+
* Nodes are matched by `PrimaryKey.value`. The weight defaults to `1` and is
|
| 182 |
+
* clamped to at least `0.1`.
|
| 183 |
+
*
|
| 184 |
+
* **Gotchas**
|
| 185 |
+
*
|
| 186 |
+
* This mutates and returns the same ring instance.
|
| 187 |
+
*
|
| 188 |
+
* @see {@link addMany} for adding or updating several nodes
|
| 189 |
+
* @see {@link remove} for unregistering a node
|
| 190 |
+
* @see {@link has} for checking primary-key membership
|
| 191 |
+
*
|
| 192 |
+
* @category combinators
|
| 193 |
+
* @since 3.19.0
|
| 194 |
*/
|
| 195 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A, options?: {
|
| 196 |
readonly weight?: number | undefined;
|
|
|
|
| 199 |
/**
|
| 200 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 201 |
*
|
| 202 |
+
* **When to use**
|
| 203 |
+
*
|
| 204 |
+
* Use to remove a node that has left the pool so future lookups and shard
|
| 205 |
+
* assignments stop returning it.
|
| 206 |
+
*
|
| 207 |
+
* **Details**
|
| 208 |
+
*
|
| 209 |
+
* Removal matches by `PrimaryKey.value`, so any value with the same primary key
|
| 210 |
+
* removes the same ring member.
|
| 211 |
+
*
|
| 212 |
+
* **Gotchas**
|
| 213 |
+
*
|
| 214 |
+
* This mutates and returns the same ring instance.
|
| 215 |
+
*
|
| 216 |
+
* @see {@link add} for registering or updating a node
|
| 217 |
+
* @see {@link has} for checking membership by primary key
|
| 218 |
+
*
|
| 219 |
+
* @category combinators
|
| 220 |
+
* @since 3.19.0
|
| 221 |
*/
|
| 222 |
export declare const remove: {
|
| 223 |
/**
|
| 224 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 225 |
*
|
| 226 |
+
* **When to use**
|
| 227 |
+
*
|
| 228 |
+
* Use to remove a node that has left the pool so future lookups and shard
|
| 229 |
+
* assignments stop returning it.
|
| 230 |
+
*
|
| 231 |
+
* **Details**
|
| 232 |
+
*
|
| 233 |
+
* Removal matches by `PrimaryKey.value`, so any value with the same primary key
|
| 234 |
+
* removes the same ring member.
|
| 235 |
+
*
|
| 236 |
+
* **Gotchas**
|
| 237 |
+
*
|
| 238 |
+
* This mutates and returns the same ring instance.
|
| 239 |
+
*
|
| 240 |
+
* @see {@link add} for registering or updating a node
|
| 241 |
+
* @see {@link has} for checking membership by primary key
|
| 242 |
+
*
|
| 243 |
+
* @category combinators
|
| 244 |
+
* @since 3.19.0
|
| 245 |
*/
|
| 246 |
<A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => HashRing<A>;
|
| 247 |
/**
|
| 248 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 249 |
*
|
| 250 |
+
* **When to use**
|
| 251 |
+
*
|
| 252 |
+
* Use to remove a node that has left the pool so future lookups and shard
|
| 253 |
+
* assignments stop returning it.
|
| 254 |
+
*
|
| 255 |
+
* **Details**
|
| 256 |
+
*
|
| 257 |
+
* Removal matches by `PrimaryKey.value`, so any value with the same primary key
|
| 258 |
+
* removes the same ring member.
|
| 259 |
+
*
|
| 260 |
+
* **Gotchas**
|
| 261 |
+
*
|
| 262 |
+
* This mutates and returns the same ring instance.
|
| 263 |
+
*
|
| 264 |
+
* @see {@link add} for registering or updating a node
|
| 265 |
+
* @see {@link has} for checking membership by primary key
|
| 266 |
+
*
|
| 267 |
+
* @category combinators
|
| 268 |
+
* @since 3.19.0
|
| 269 |
*/
|
| 270 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): HashRing<A>;
|
| 271 |
};
|
| 272 |
/**
|
| 273 |
+
* Checks whether the ring contains a node with the same `PrimaryKey` value.
|
| 274 |
+
*
|
| 275 |
+
* **When to use**
|
| 276 |
+
*
|
| 277 |
+
* Use when you need to know whether registering a node would update an existing
|
| 278 |
+
* ring member because another node already has the same primary-key identity.
|
| 279 |
+
*
|
| 280 |
+
* **Details**
|
| 281 |
+
*
|
| 282 |
+
* Membership is checked with `self.nodes.has(PrimaryKey.value(node))`, so
|
| 283 |
+
* matching is by primary key, not object identity or weight.
|
| 284 |
+
*
|
| 285 |
+
* @see {@link add} for registering or updating nodes
|
| 286 |
+
* @see {@link remove} for removing nodes by the same primary-key identity
|
| 287 |
+
* @see {@link get} for routing an input string to a node
|
| 288 |
+
*
|
| 289 |
+
* @category combinators
|
| 290 |
+
* @since 3.19.0
|
| 291 |
*/
|
| 292 |
export declare const has: {
|
| 293 |
/**
|
| 294 |
+
* Checks whether the ring contains a node with the same `PrimaryKey` value.
|
| 295 |
+
*
|
| 296 |
+
* **When to use**
|
| 297 |
+
*
|
| 298 |
+
* Use when you need to know whether registering a node would update an existing
|
| 299 |
+
* ring member because another node already has the same primary-key identity.
|
| 300 |
+
*
|
| 301 |
+
* **Details**
|
| 302 |
+
*
|
| 303 |
+
* Membership is checked with `self.nodes.has(PrimaryKey.value(node))`, so
|
| 304 |
+
* matching is by primary key, not object identity or weight.
|
| 305 |
+
*
|
| 306 |
+
* @see {@link add} for registering or updating nodes
|
| 307 |
+
* @see {@link remove} for removing nodes by the same primary-key identity
|
| 308 |
+
* @see {@link get} for routing an input string to a node
|
| 309 |
+
*
|
| 310 |
+
* @category combinators
|
| 311 |
+
* @since 3.19.0
|
| 312 |
*/
|
| 313 |
<A extends PrimaryKey.PrimaryKey>(node: A): (self: HashRing<A>) => boolean;
|
| 314 |
/**
|
| 315 |
+
* Checks whether the ring contains a node with the same `PrimaryKey` value.
|
| 316 |
+
*
|
| 317 |
+
* **When to use**
|
| 318 |
+
*
|
| 319 |
+
* Use when you need to know whether registering a node would update an existing
|
| 320 |
+
* ring member because another node already has the same primary-key identity.
|
| 321 |
+
*
|
| 322 |
+
* **Details**
|
| 323 |
+
*
|
| 324 |
+
* Membership is checked with `self.nodes.has(PrimaryKey.value(node))`, so
|
| 325 |
+
* matching is by primary key, not object identity or weight.
|
| 326 |
+
*
|
| 327 |
+
* @see {@link add} for registering or updating nodes
|
| 328 |
+
* @see {@link remove} for removing nodes by the same primary-key identity
|
| 329 |
+
* @see {@link get} for routing an input string to a node
|
| 330 |
+
*
|
| 331 |
+
* @category combinators
|
| 332 |
+
* @since 3.19.0
|
| 333 |
*/
|
| 334 |
<A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, node: A): boolean;
|
| 335 |
};
|
|
|
|
| 337 |
* Gets the node which should handle the given input. Returns undefined if
|
| 338 |
* the hashring has no elements with weight.
|
| 339 |
*
|
| 340 |
+
* **When to use**
|
| 341 |
+
*
|
| 342 |
+
* Use to route a single string input key to the current ring member responsible
|
| 343 |
+
* for that key.
|
| 344 |
+
*
|
| 345 |
+
* @see {@link getShards} for assigning fixed shard indexes instead of routing
|
| 346 |
+
* one input string at a time
|
| 347 |
+
*
|
| 348 |
+
* @category combinators
|
| 349 |
+
* @since 3.19.0
|
| 350 |
*/
|
| 351 |
export declare const get: <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, input: string) => A | undefined;
|
| 352 |
/**
|
| 353 |
+
* Computes a balanced shard distribution across the nodes in the ring.
|
| 354 |
+
*
|
| 355 |
+
* **When to use**
|
| 356 |
+
*
|
| 357 |
+
* Use to precompute ownership for a fixed number of shard indexes across the
|
| 358 |
+
* current ring members.
|
| 359 |
*
|
| 360 |
+
* @category combinators
|
| 361 |
+
* @since 3.19.0
|
| 362 |
*/
|
| 363 |
export declare const getShards: <A extends PrimaryKey.PrimaryKey>(self: HashRing<A>, count: number) => Array<A> | undefined;
|
| 364 |
export {};
|
.opencode/node_modules/effect/dist/HashRing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashRing.d.ts","sourceRoot":"","sources":["../src/HashRing.ts"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"HashRing.d.ts","sourceRoot":"","sources":["../src/HashRing.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAE7C,QAAA,MAAM,MAAM,EAAG,0BAAmC,CAAA;AAElD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,UAAU,CAAC,UAAU,CAAE,SAAQ,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtF,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACtD,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAA2B,CAAA;AAEpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,UAAU,CAAC,UAAU,EAAE,UAAU;IAC9D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACzC,KAAG,QAAQ,CAAC,CAAC,CAOb,CAAA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,CAAC,GAAG,SA6DxG,CAAA"}
|
.opencode/node_modules/effect/dist/HashRing.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 4.0.0
|
| 3 |
*/
|
| 4 |
import { dual } from "./Function.js";
|
|
@@ -9,13 +17,48 @@ import { hasProperty } from "./Predicate.js";
|
|
| 9 |
import * as PrimaryKey from "./PrimaryKey.js";
|
| 10 |
const TypeId = "~effect/cluster/HashRing";
|
| 11 |
/**
|
| 12 |
-
*
|
| 13 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
*/
|
| 15 |
export const isHashRing = u => hasProperty(u, TypeId);
|
| 16 |
/**
|
| 17 |
-
*
|
| 18 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
*/
|
| 20 |
export const make = options => {
|
| 21 |
const self = Object.create(Proto);
|
|
@@ -40,11 +83,15 @@ const Proto = {
|
|
| 40 |
}
|
| 41 |
};
|
| 42 |
/**
|
| 43 |
-
*
|
| 44 |
* will be updated. For example, you can use this to update the node's weight.
|
| 45 |
*
|
| 46 |
-
*
|
| 47 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
*/
|
| 49 |
export const addMany = /*#__PURE__*/dual(args => isHashRing(args[0]), (self, nodes, options) => {
|
| 50 |
const weight = Math.max(options?.weight ?? 1, 0.1);
|
|
@@ -82,18 +129,53 @@ function addNodesToRing(self, keys, weight) {
|
|
| 82 |
self.ring.sort((a, b) => a[0] - b[0]);
|
| 83 |
}
|
| 84 |
/**
|
| 85 |
-
*
|
| 86 |
* will be updated. For example, you can use this to update the node's weight.
|
| 87 |
*
|
| 88 |
-
*
|
| 89 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
*/
|
| 91 |
export const add = /*#__PURE__*/dual(args => isHashRing(args[0]), (self, node, options) => addMany(self, [node], options));
|
| 92 |
/**
|
| 93 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 94 |
*
|
| 95 |
-
*
|
| 96 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
*/
|
| 98 |
export const remove = /*#__PURE__*/dual(2, (self, node) => {
|
| 99 |
const key = PrimaryKey.value(node);
|
|
@@ -106,16 +188,40 @@ export const remove = /*#__PURE__*/dual(2, (self, node) => {
|
|
| 106 |
return self;
|
| 107 |
});
|
| 108 |
/**
|
| 109 |
-
*
|
| 110 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
*/
|
| 112 |
export const has = /*#__PURE__*/dual(2, (self, node) => self.nodes.has(PrimaryKey.value(node)));
|
| 113 |
/**
|
| 114 |
* Gets the node which should handle the given input. Returns undefined if
|
| 115 |
* the hashring has no elements with weight.
|
| 116 |
*
|
| 117 |
-
*
|
| 118 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
*/
|
| 120 |
export const get = (self, input) => {
|
| 121 |
if (self.ring.length === 0) {
|
|
@@ -126,12 +232,15 @@ export const get = (self, input) => {
|
|
| 126 |
return self.nodes.get(node)[0];
|
| 127 |
};
|
| 128 |
/**
|
| 129 |
-
*
|
| 130 |
-
* balance the number of shards allocated to each node. Returns undefined if
|
| 131 |
-
* the hashring has no elements with weight.
|
| 132 |
*
|
| 133 |
-
*
|
| 134 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
*/
|
| 136 |
export const getShards = (self, count) => {
|
| 137 |
if (self.ring.length === 0) {
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Assigns string inputs to nodes with weighted consistent hashing.
|
| 3 |
+
*
|
| 4 |
+
* A hash ring minimizes remapping when nodes are added, removed, or reweighted.
|
| 5 |
+
* This makes it useful for routing requests, partitioning keys, and
|
| 6 |
+
* distributing shards across service instances or storage backends. This module
|
| 7 |
+
* can create rings, add or remove nodes by `PrimaryKey`, route an input string
|
| 8 |
+
* to a node, and compute shard assignments.
|
| 9 |
+
*
|
| 10 |
* @since 4.0.0
|
| 11 |
*/
|
| 12 |
import { dual } from "./Function.js";
|
|
|
|
| 17 |
import * as PrimaryKey from "./PrimaryKey.js";
|
| 18 |
const TypeId = "~effect/cluster/HashRing";
|
| 19 |
/**
|
| 20 |
+
* Checks whether a value is a `HashRing`.
|
| 21 |
+
*
|
| 22 |
+
* **When to use**
|
| 23 |
+
*
|
| 24 |
+
* Use to narrow an `unknown` value before treating it as a `HashRing`, such as
|
| 25 |
+
* values crossing an untyped boundary.
|
| 26 |
+
*
|
| 27 |
+
* **Details**
|
| 28 |
+
*
|
| 29 |
+
* The guard checks for the module's internal `TypeId` property and narrows to
|
| 30 |
+
* `HashRing<any>`.
|
| 31 |
+
*
|
| 32 |
+
* **Gotchas**
|
| 33 |
+
*
|
| 34 |
+
* This is a structural type-id check; it does not validate the ring's `nodes`,
|
| 35 |
+
* `ring`, or weight state.
|
| 36 |
+
*
|
| 37 |
+
* @see {@link HashRing} for the type narrowed by this guard
|
| 38 |
+
* @see {@link make} for creating an empty `HashRing`
|
| 39 |
+
*
|
| 40 |
+
* @category guards
|
| 41 |
+
* @since 3.19.0
|
| 42 |
*/
|
| 43 |
export const isHashRing = u => hasProperty(u, TypeId);
|
| 44 |
/**
|
| 45 |
+
* Creates an empty `HashRing`.
|
| 46 |
+
*
|
| 47 |
+
* **When to use**
|
| 48 |
+
*
|
| 49 |
+
* Use to create an empty weighted consistent-hashing ring with the default or
|
| 50 |
+
* custom virtual-point density.
|
| 51 |
+
*
|
| 52 |
+
* **Details**
|
| 53 |
+
*
|
| 54 |
+
* `baseWeight` controls how many virtual points are added for a node with
|
| 55 |
+
* weight `1`; it defaults to `128` and is clamped to at least `1`.
|
| 56 |
+
*
|
| 57 |
+
* @see {@link add} for registering one node after creation
|
| 58 |
+
* @see {@link addMany} for registering several nodes after creation
|
| 59 |
+
*
|
| 60 |
+
* @category constructors
|
| 61 |
+
* @since 3.19.0
|
| 62 |
*/
|
| 63 |
export const make = options => {
|
| 64 |
const self = Object.create(Proto);
|
|
|
|
| 83 |
}
|
| 84 |
};
|
| 85 |
/**
|
| 86 |
+
* Adds new nodes to the ring. If a node already exists in the ring, it
|
| 87 |
* will be updated. For example, you can use this to update the node's weight.
|
| 88 |
*
|
| 89 |
+
* **When to use**
|
| 90 |
+
*
|
| 91 |
+
* Use to register or update several nodes in a `HashRing` at the same weight.
|
| 92 |
+
*
|
| 93 |
+
* @category combinators
|
| 94 |
+
* @since 3.19.0
|
| 95 |
*/
|
| 96 |
export const addMany = /*#__PURE__*/dual(args => isHashRing(args[0]), (self, nodes, options) => {
|
| 97 |
const weight = Math.max(options?.weight ?? 1, 0.1);
|
|
|
|
| 129 |
self.ring.sort((a, b) => a[0] - b[0]);
|
| 130 |
}
|
| 131 |
/**
|
| 132 |
+
* Adds a new node to the ring. If the node already exists in the ring, it
|
| 133 |
* will be updated. For example, you can use this to update the node's weight.
|
| 134 |
*
|
| 135 |
+
* **When to use**
|
| 136 |
+
*
|
| 137 |
+
* Use to register one node in a `HashRing` so lookups and shard assignments can
|
| 138 |
+
* return it, or update that node's weight.
|
| 139 |
+
*
|
| 140 |
+
* **Details**
|
| 141 |
+
*
|
| 142 |
+
* Nodes are matched by `PrimaryKey.value`. The weight defaults to `1` and is
|
| 143 |
+
* clamped to at least `0.1`.
|
| 144 |
+
*
|
| 145 |
+
* **Gotchas**
|
| 146 |
+
*
|
| 147 |
+
* This mutates and returns the same ring instance.
|
| 148 |
+
*
|
| 149 |
+
* @see {@link addMany} for adding or updating several nodes
|
| 150 |
+
* @see {@link remove} for unregistering a node
|
| 151 |
+
* @see {@link has} for checking primary-key membership
|
| 152 |
+
*
|
| 153 |
+
* @category combinators
|
| 154 |
+
* @since 3.19.0
|
| 155 |
*/
|
| 156 |
export const add = /*#__PURE__*/dual(args => isHashRing(args[0]), (self, node, options) => addMany(self, [node], options));
|
| 157 |
/**
|
| 158 |
* Removes the node from the ring. No-op's if the node does not exist.
|
| 159 |
*
|
| 160 |
+
* **When to use**
|
| 161 |
+
*
|
| 162 |
+
* Use to remove a node that has left the pool so future lookups and shard
|
| 163 |
+
* assignments stop returning it.
|
| 164 |
+
*
|
| 165 |
+
* **Details**
|
| 166 |
+
*
|
| 167 |
+
* Removal matches by `PrimaryKey.value`, so any value with the same primary key
|
| 168 |
+
* removes the same ring member.
|
| 169 |
+
*
|
| 170 |
+
* **Gotchas**
|
| 171 |
+
*
|
| 172 |
+
* This mutates and returns the same ring instance.
|
| 173 |
+
*
|
| 174 |
+
* @see {@link add} for registering or updating a node
|
| 175 |
+
* @see {@link has} for checking membership by primary key
|
| 176 |
+
*
|
| 177 |
+
* @category combinators
|
| 178 |
+
* @since 3.19.0
|
| 179 |
*/
|
| 180 |
export const remove = /*#__PURE__*/dual(2, (self, node) => {
|
| 181 |
const key = PrimaryKey.value(node);
|
|
|
|
| 188 |
return self;
|
| 189 |
});
|
| 190 |
/**
|
| 191 |
+
* Checks whether the ring contains a node with the same `PrimaryKey` value.
|
| 192 |
+
*
|
| 193 |
+
* **When to use**
|
| 194 |
+
*
|
| 195 |
+
* Use when you need to know whether registering a node would update an existing
|
| 196 |
+
* ring member because another node already has the same primary-key identity.
|
| 197 |
+
*
|
| 198 |
+
* **Details**
|
| 199 |
+
*
|
| 200 |
+
* Membership is checked with `self.nodes.has(PrimaryKey.value(node))`, so
|
| 201 |
+
* matching is by primary key, not object identity or weight.
|
| 202 |
+
*
|
| 203 |
+
* @see {@link add} for registering or updating nodes
|
| 204 |
+
* @see {@link remove} for removing nodes by the same primary-key identity
|
| 205 |
+
* @see {@link get} for routing an input string to a node
|
| 206 |
+
*
|
| 207 |
+
* @category combinators
|
| 208 |
+
* @since 3.19.0
|
| 209 |
*/
|
| 210 |
export const has = /*#__PURE__*/dual(2, (self, node) => self.nodes.has(PrimaryKey.value(node)));
|
| 211 |
/**
|
| 212 |
* Gets the node which should handle the given input. Returns undefined if
|
| 213 |
* the hashring has no elements with weight.
|
| 214 |
*
|
| 215 |
+
* **When to use**
|
| 216 |
+
*
|
| 217 |
+
* Use to route a single string input key to the current ring member responsible
|
| 218 |
+
* for that key.
|
| 219 |
+
*
|
| 220 |
+
* @see {@link getShards} for assigning fixed shard indexes instead of routing
|
| 221 |
+
* one input string at a time
|
| 222 |
+
*
|
| 223 |
+
* @category combinators
|
| 224 |
+
* @since 3.19.0
|
| 225 |
*/
|
| 226 |
export const get = (self, input) => {
|
| 227 |
if (self.ring.length === 0) {
|
|
|
|
| 232 |
return self.nodes.get(node)[0];
|
| 233 |
};
|
| 234 |
/**
|
| 235 |
+
* Computes a balanced shard distribution across the nodes in the ring.
|
|
|
|
|
|
|
| 236 |
*
|
| 237 |
+
* **When to use**
|
| 238 |
+
*
|
| 239 |
+
* Use to precompute ownership for a fixed number of shard indexes across the
|
| 240 |
+
* current ring members.
|
| 241 |
+
*
|
| 242 |
+
* @category combinators
|
| 243 |
+
* @since 3.19.0
|
| 244 |
*/
|
| 245 |
export const getShards = (self, count) => {
|
| 246 |
if (self.ring.length === 0) {
|
.opencode/node_modules/effect/dist/HashRing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashRing.js","names":["dual","Hash","PipeInspectableProto","Iterable","hasProperty","PrimaryKey","TypeId","isHashRing","u","make","options","self","Object","create","Proto","baseWeight","Math","max","totalWeightCache","nodes","Map","ring","Symbol","iterator","map","values","n","toJSON","_id","get","addMany","args","weight","keys","toRemove","node","key","value","entry","Set","add","set","push","filter","has","addNodesToRing","round","i","j","length","string","sort","a","b","remove","delete","input","undefined","index","getIndexForInput","getShards","count","shards","Array","allocations","remaining","exclude","distances","shard","hash","shardHashes","distance","nodeCount","maxPerNode","floor","allAtMax","size","forEach","len","mid","lo","hi","distA","abs","distB","range"],"sources":["../src/HashRing.ts"],"sourcesContent":[null],"mappings":"AAAA;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"HashRing.js","names":["dual","Hash","PipeInspectableProto","Iterable","hasProperty","PrimaryKey","TypeId","isHashRing","u","make","options","self","Object","create","Proto","baseWeight","Math","max","totalWeightCache","nodes","Map","ring","Symbol","iterator","map","values","n","toJSON","_id","get","addMany","args","weight","keys","toRemove","node","key","value","entry","Set","add","set","push","filter","has","addNodesToRing","round","i","j","length","string","sort","a","b","remove","delete","input","undefined","index","getIndexForInput","getShards","count","shards","Array","allocations","remaining","exclude","distances","shard","hash","shardHashes","distance","nodeCount","maxPerNode","floor","allAtMax","size","forEach","len","mid","lo","hi","distA","abs","distB","range"],"sources":["../src/HashRing.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,SAASA,IAAI,QAAQ,eAAe;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAEzC,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,OAAO,KAAKC,UAAU,MAAM,iBAAiB;AAE7C,MAAMC,MAAM,GAAG,0BAAmC;AA2BlD;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,OAAO,MAAMC,UAAU,GAAIC,CAAU,IAAyBJ,WAAW,CAACI,CA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B","ignoreList":[]}
|
.opencode/node_modules/effect/dist/HashSet.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 2.0.0
|
| 3 |
*/
|
| 4 |
import type { Equal } from "./Equal.ts";
|
|
@@ -11,9 +19,10 @@ declare const TypeId = "~effect/collections/HashSet";
|
|
| 11 |
* A HashSet is an immutable set data structure that provides efficient storage
|
| 12 |
* and retrieval of unique values. It uses a HashMap internally for optimal performance.
|
| 13 |
*
|
| 14 |
-
*
|
|
|
|
| 15 |
* ```ts
|
| 16 |
-
* import
|
| 17 |
*
|
| 18 |
* // Create a HashSet
|
| 19 |
* const set = HashSet.make("apple", "banana", "cherry")
|
|
@@ -31,8 +40,8 @@ declare const TypeId = "~effect/collections/HashSet";
|
|
| 31 |
* console.log(HashSet.size(smaller)) // 2
|
| 32 |
* ```
|
| 33 |
*
|
| 34 |
-
* @since 2.0.0
|
| 35 |
* @category models
|
|
|
|
| 36 |
*/
|
| 37 |
export interface HashSet<out Value> extends Iterable<Value>, Equal, Pipeable, Inspectable {
|
| 38 |
readonly [TypeId]: typeof TypeId;
|
|
@@ -41,9 +50,10 @@ export interface HashSet<out Value> extends Iterable<Value>, Equal, Pipeable, In
|
|
| 41 |
* The HashSet namespace contains type-level utilities and helper types
|
| 42 |
* for working with HashSet instances.
|
| 43 |
*
|
| 44 |
-
*
|
|
|
|
| 45 |
* ```ts
|
| 46 |
-
* import
|
| 47 |
*
|
| 48 |
* // Create a concrete HashSet for type extraction
|
| 49 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
|
@@ -58,13 +68,19 @@ export interface HashSet<out Value> extends Iterable<Value>, Equal, Pipeable, In
|
|
| 58 |
* ```
|
| 59 |
*
|
| 60 |
* @since 2.0.0
|
| 61 |
-
* @category namespace
|
| 62 |
*/
|
| 63 |
export declare namespace HashSet {
|
| 64 |
/**
|
| 65 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
* ```ts
|
| 67 |
-
* import
|
| 68 |
*
|
| 69 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 70 |
*
|
|
@@ -74,17 +90,18 @@ export declare namespace HashSet {
|
|
| 74 |
* const processNumber = (n: NumberType) => n * 2
|
| 75 |
* ```
|
| 76 |
*
|
| 77 |
-
* @
|
| 78 |
-
* @
|
| 79 |
*/
|
| 80 |
type Value<T> = T extends HashSet<infer V> ? V : never;
|
| 81 |
}
|
| 82 |
/**
|
| 83 |
* Creates an empty HashSet.
|
| 84 |
*
|
| 85 |
-
*
|
|
|
|
| 86 |
* ```ts
|
| 87 |
-
* import
|
| 88 |
*
|
| 89 |
* const set = HashSet.empty<string>()
|
| 90 |
*
|
|
@@ -96,16 +113,17 @@ export declare namespace HashSet {
|
|
| 96 |
* console.log(HashSet.size(withValues)) // 2
|
| 97 |
* ```
|
| 98 |
*
|
| 99 |
-
* @since 2.0.0
|
| 100 |
* @category constructors
|
|
|
|
| 101 |
*/
|
| 102 |
export declare const empty: <V = never>() => HashSet<V>;
|
| 103 |
/**
|
| 104 |
* Creates a HashSet from a variable number of values.
|
| 105 |
*
|
| 106 |
-
*
|
|
|
|
| 107 |
* ```ts
|
| 108 |
-
* import
|
| 109 |
*
|
| 110 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
| 111 |
* console.log(HashSet.size(fruits)) // 3
|
|
@@ -117,16 +135,17 @@ export declare const empty: <V = never>() => HashSet<V>;
|
|
| 117 |
* console.log(HashSet.size(mixed)) // 3
|
| 118 |
* ```
|
| 119 |
*
|
| 120 |
-
* @since 2.0.0
|
| 121 |
* @category constructors
|
|
|
|
| 122 |
*/
|
| 123 |
export declare const make: <Values extends ReadonlyArray<any>>(...values: Values) => HashSet<Values[number]>;
|
| 124 |
/**
|
| 125 |
* Creates a HashSet from an iterable collection of values.
|
| 126 |
*
|
| 127 |
-
*
|
|
|
|
| 128 |
* ```ts
|
| 129 |
-
* import
|
| 130 |
*
|
| 131 |
* const fromArray = HashSet.fromIterable(["a", "b", "c", "b", "a"])
|
| 132 |
* console.log(HashSet.size(fromArray)) // 3
|
|
@@ -138,16 +157,17 @@ export declare const make: <Values extends ReadonlyArray<any>>(...values: Values
|
|
| 138 |
* console.log(Array.from(fromString)) // ["h", "e", "l", "o"]
|
| 139 |
* ```
|
| 140 |
*
|
| 141 |
-
* @since 2.0.0
|
| 142 |
* @category constructors
|
|
|
|
| 143 |
*/
|
| 144 |
export declare const fromIterable: <V>(values: Iterable<V>) => HashSet<V>;
|
| 145 |
/**
|
| 146 |
-
* Checks
|
|
|
|
|
|
|
| 147 |
*
|
| 148 |
-
* @example
|
| 149 |
* ```ts
|
| 150 |
-
* import
|
| 151 |
*
|
| 152 |
* const set = HashSet.make(1, 2, 3)
|
| 153 |
* const array = [1, 2, 3]
|
|
@@ -157,16 +177,17 @@ export declare const fromIterable: <V>(values: Iterable<V>) => HashSet<V>;
|
|
| 157 |
* console.log(HashSet.isHashSet(null)) // false
|
| 158 |
* ```
|
| 159 |
*
|
| 160 |
-
* @since 2.0.0
|
| 161 |
* @category guards
|
|
|
|
| 162 |
*/
|
| 163 |
export declare const isHashSet: {
|
| 164 |
/**
|
| 165 |
-
* Checks
|
|
|
|
|
|
|
| 166 |
*
|
| 167 |
-
* @example
|
| 168 |
* ```ts
|
| 169 |
-
* import
|
| 170 |
*
|
| 171 |
* const set = HashSet.make(1, 2, 3)
|
| 172 |
* const array = [1, 2, 3]
|
|
@@ -176,16 +197,17 @@ export declare const isHashSet: {
|
|
| 176 |
* console.log(HashSet.isHashSet(null)) // false
|
| 177 |
* ```
|
| 178 |
*
|
| 179 |
-
* @since 2.0.0
|
| 180 |
* @category guards
|
|
|
|
| 181 |
*/
|
| 182 |
<V>(u: Iterable<V>): u is HashSet<V>;
|
| 183 |
/**
|
| 184 |
-
* Checks
|
|
|
|
|
|
|
| 185 |
*
|
| 186 |
-
* @example
|
| 187 |
* ```ts
|
| 188 |
-
* import
|
| 189 |
*
|
| 190 |
* const set = HashSet.make(1, 2, 3)
|
| 191 |
* const array = [1, 2, 3]
|
|
@@ -195,17 +217,18 @@ export declare const isHashSet: {
|
|
| 195 |
* console.log(HashSet.isHashSet(null)) // false
|
| 196 |
* ```
|
| 197 |
*
|
| 198 |
-
* @since 2.0.0
|
| 199 |
* @category guards
|
|
|
|
| 200 |
*/
|
| 201 |
(u: unknown): u is HashSet<unknown>;
|
| 202 |
};
|
| 203 |
/**
|
| 204 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 205 |
*
|
| 206 |
-
*
|
|
|
|
| 207 |
* ```ts
|
| 208 |
-
* import
|
| 209 |
*
|
| 210 |
* const set = HashSet.make("a", "b")
|
| 211 |
* const withC = HashSet.add(set, "c")
|
|
@@ -219,16 +242,17 @@ export declare const isHashSet: {
|
|
| 219 |
* console.log(HashSet.size(same)) // 2
|
| 220 |
* ```
|
| 221 |
*
|
| 222 |
-
* @since 2.0.0
|
| 223 |
* @category mutations
|
|
|
|
| 224 |
*/
|
| 225 |
export declare const add: {
|
| 226 |
/**
|
| 227 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 228 |
*
|
| 229 |
-
*
|
|
|
|
| 230 |
* ```ts
|
| 231 |
-
* import
|
| 232 |
*
|
| 233 |
* const set = HashSet.make("a", "b")
|
| 234 |
* const withC = HashSet.add(set, "c")
|
|
@@ -242,16 +266,17 @@ export declare const add: {
|
|
| 242 |
* console.log(HashSet.size(same)) // 2
|
| 243 |
* ```
|
| 244 |
*
|
| 245 |
-
* @since 2.0.0
|
| 246 |
* @category mutations
|
|
|
|
| 247 |
*/
|
| 248 |
<V>(value: V): (self: HashSet<V>) => HashSet<V>;
|
| 249 |
/**
|
| 250 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 251 |
*
|
| 252 |
-
*
|
|
|
|
| 253 |
* ```ts
|
| 254 |
-
* import
|
| 255 |
*
|
| 256 |
* const set = HashSet.make("a", "b")
|
| 257 |
* const withC = HashSet.add(set, "c")
|
|
@@ -265,25 +290,25 @@ export declare const add: {
|
|
| 265 |
* console.log(HashSet.size(same)) // 2
|
| 266 |
* ```
|
| 267 |
*
|
| 268 |
-
* @since 2.0.0
|
| 269 |
* @category mutations
|
|
|
|
| 270 |
*/
|
| 271 |
<V>(self: HashSet<V>, value: V): HashSet<V>;
|
| 272 |
};
|
| 273 |
/**
|
| 274 |
-
* Checks
|
|
|
|
|
|
|
| 275 |
*
|
| 276 |
-
* @example
|
| 277 |
* ```ts
|
| 278 |
-
* import
|
| 279 |
*
|
| 280 |
* // Works with any type that implements Equal
|
| 281 |
-
* import { Equal, Hash } from "effect"
|
| 282 |
*
|
| 283 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 284 |
*
|
| 285 |
* console.log(HashSet.has(set, "apple")) // true
|
| 286 |
-
* console.log(HashSet.has(set, "grape"))
|
| 287 |
*
|
| 288 |
* class Person implements Equal.Equal {
|
| 289 |
* constructor(readonly name: string) {}
|
|
@@ -301,24 +326,24 @@ export declare const add: {
|
|
| 301 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 302 |
* ```
|
| 303 |
*
|
| 304 |
-
* @since 2.0.0
|
| 305 |
* @category elements
|
|
|
|
| 306 |
*/
|
| 307 |
export declare const has: {
|
| 308 |
/**
|
| 309 |
-
* Checks
|
|
|
|
|
|
|
| 310 |
*
|
| 311 |
-
* @example
|
| 312 |
* ```ts
|
| 313 |
-
* import
|
| 314 |
*
|
| 315 |
* // Works with any type that implements Equal
|
| 316 |
-
* import { Equal, Hash } from "effect"
|
| 317 |
*
|
| 318 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 319 |
*
|
| 320 |
* console.log(HashSet.has(set, "apple")) // true
|
| 321 |
-
* console.log(HashSet.has(set, "grape"))
|
| 322 |
*
|
| 323 |
* class Person implements Equal.Equal {
|
| 324 |
* constructor(readonly name: string) {}
|
|
@@ -336,24 +361,24 @@ export declare const has: {
|
|
| 336 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 337 |
* ```
|
| 338 |
*
|
| 339 |
-
* @since 2.0.0
|
| 340 |
* @category elements
|
|
|
|
| 341 |
*/
|
| 342 |
<V>(value: V): (self: HashSet<V>) => boolean;
|
| 343 |
/**
|
| 344 |
-
* Checks
|
|
|
|
|
|
|
| 345 |
*
|
| 346 |
-
* @example
|
| 347 |
* ```ts
|
| 348 |
-
* import
|
| 349 |
*
|
| 350 |
* // Works with any type that implements Equal
|
| 351 |
-
* import { Equal, Hash } from "effect"
|
| 352 |
*
|
| 353 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 354 |
*
|
| 355 |
* console.log(HashSet.has(set, "apple")) // true
|
| 356 |
-
* console.log(HashSet.has(set, "grape"))
|
| 357 |
*
|
| 358 |
* class Person implements Equal.Equal {
|
| 359 |
* constructor(readonly name: string) {}
|
|
@@ -371,17 +396,18 @@ export declare const has: {
|
|
| 371 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 372 |
* ```
|
| 373 |
*
|
| 374 |
-
* @since 2.0.0
|
| 375 |
* @category elements
|
|
|
|
| 376 |
*/
|
| 377 |
<V>(self: HashSet<V>, value: V): boolean;
|
| 378 |
};
|
| 379 |
/**
|
| 380 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 381 |
*
|
| 382 |
-
*
|
|
|
|
| 383 |
* ```ts
|
| 384 |
-
* import
|
| 385 |
*
|
| 386 |
* const set = HashSet.make("a", "b", "c")
|
| 387 |
* const withoutB = HashSet.remove(set, "b")
|
|
@@ -395,16 +421,17 @@ export declare const has: {
|
|
| 395 |
* console.log(HashSet.size(same)) // 3
|
| 396 |
* ```
|
| 397 |
*
|
| 398 |
-
* @since 2.0.0
|
| 399 |
* @category mutations
|
|
|
|
| 400 |
*/
|
| 401 |
export declare const remove: {
|
| 402 |
/**
|
| 403 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 404 |
*
|
| 405 |
-
*
|
|
|
|
| 406 |
* ```ts
|
| 407 |
-
* import
|
| 408 |
*
|
| 409 |
* const set = HashSet.make("a", "b", "c")
|
| 410 |
* const withoutB = HashSet.remove(set, "b")
|
|
@@ -418,16 +445,17 @@ export declare const remove: {
|
|
| 418 |
* console.log(HashSet.size(same)) // 3
|
| 419 |
* ```
|
| 420 |
*
|
| 421 |
-
* @since 2.0.0
|
| 422 |
* @category mutations
|
|
|
|
| 423 |
*/
|
| 424 |
<V>(value: V): (self: HashSet<V>) => HashSet<V>;
|
| 425 |
/**
|
| 426 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 427 |
*
|
| 428 |
-
*
|
|
|
|
| 429 |
* ```ts
|
| 430 |
-
* import
|
| 431 |
*
|
| 432 |
* const set = HashSet.make("a", "b", "c")
|
| 433 |
* const withoutB = HashSet.remove(set, "b")
|
|
@@ -441,17 +469,18 @@ export declare const remove: {
|
|
| 441 |
* console.log(HashSet.size(same)) // 3
|
| 442 |
* ```
|
| 443 |
*
|
| 444 |
-
* @since 2.0.0
|
| 445 |
* @category mutations
|
|
|
|
| 446 |
*/
|
| 447 |
<V>(self: HashSet<V>, value: V): HashSet<V>;
|
| 448 |
};
|
| 449 |
/**
|
| 450 |
* Returns the number of values in the HashSet.
|
| 451 |
*
|
| 452 |
-
*
|
|
|
|
| 453 |
* ```ts
|
| 454 |
-
* import
|
| 455 |
*
|
| 456 |
* const empty = HashSet.empty<string>()
|
| 457 |
* console.log(HashSet.size(empty)) // 0
|
|
@@ -463,16 +492,17 @@ export declare const remove: {
|
|
| 463 |
* console.log(HashSet.size(withDuplicates)) // 3
|
| 464 |
* ```
|
| 465 |
*
|
| 466 |
-
* @since 2.0.0
|
| 467 |
* @category getters
|
|
|
|
| 468 |
*/
|
| 469 |
export declare const size: <V>(self: HashSet<V>) => number;
|
| 470 |
/**
|
| 471 |
-
* Checks
|
|
|
|
|
|
|
| 472 |
*
|
| 473 |
-
* @example
|
| 474 |
* ```ts
|
| 475 |
-
* import
|
| 476 |
*
|
| 477 |
* const empty = HashSet.empty<string>()
|
| 478 |
* console.log(HashSet.isEmpty(empty)) // true
|
|
@@ -481,16 +511,17 @@ export declare const size: <V>(self: HashSet<V>) => number;
|
|
| 481 |
* console.log(HashSet.isEmpty(nonEmpty)) // false
|
| 482 |
* ```
|
| 483 |
*
|
| 484 |
-
* @since 2.0.0
|
| 485 |
* @category getters
|
|
|
|
| 486 |
*/
|
| 487 |
export declare const isEmpty: <V>(self: HashSet<V>) => boolean;
|
| 488 |
/**
|
| 489 |
* Creates the union of two HashSets.
|
| 490 |
*
|
| 491 |
-
*
|
|
|
|
| 492 |
* ```ts
|
| 493 |
-
* import
|
| 494 |
*
|
| 495 |
* const set1 = HashSet.make("a", "b")
|
| 496 |
* const set2 = HashSet.make("b", "c")
|
|
@@ -500,16 +531,17 @@ export declare const isEmpty: <V>(self: HashSet<V>) => boolean;
|
|
| 500 |
* console.log(HashSet.size(combined)) // 3
|
| 501 |
* ```
|
| 502 |
*
|
| 503 |
-
* @since 2.0.0
|
| 504 |
* @category combinators
|
|
|
|
| 505 |
*/
|
| 506 |
export declare const union: {
|
| 507 |
/**
|
| 508 |
* Creates the union of two HashSets.
|
| 509 |
*
|
| 510 |
-
*
|
|
|
|
| 511 |
* ```ts
|
| 512 |
-
* import
|
| 513 |
*
|
| 514 |
* const set1 = HashSet.make("a", "b")
|
| 515 |
* const set2 = HashSet.make("b", "c")
|
|
@@ -519,16 +551,17 @@ export declare const union: {
|
|
| 519 |
* console.log(HashSet.size(combined)) // 3
|
| 520 |
* ```
|
| 521 |
*
|
| 522 |
-
* @since 2.0.0
|
| 523 |
* @category combinators
|
|
|
|
| 524 |
*/
|
| 525 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 | V0>;
|
| 526 |
/**
|
| 527 |
* Creates the union of two HashSets.
|
| 528 |
*
|
| 529 |
-
*
|
|
|
|
| 530 |
* ```ts
|
| 531 |
-
* import
|
| 532 |
*
|
| 533 |
* const set1 = HashSet.make("a", "b")
|
| 534 |
* const set2 = HashSet.make("b", "c")
|
|
@@ -538,17 +571,18 @@ export declare const union: {
|
|
| 538 |
* console.log(HashSet.size(combined)) // 3
|
| 539 |
* ```
|
| 540 |
*
|
| 541 |
-
* @since 2.0.0
|
| 542 |
* @category combinators
|
|
|
|
| 543 |
*/
|
| 544 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 | V1>;
|
| 545 |
};
|
| 546 |
/**
|
| 547 |
* Creates the intersection of two HashSets.
|
| 548 |
*
|
| 549 |
-
*
|
|
|
|
| 550 |
* ```ts
|
| 551 |
-
* import
|
| 552 |
*
|
| 553 |
* const set1 = HashSet.make("a", "b", "c")
|
| 554 |
* const set2 = HashSet.make("b", "c", "d")
|
|
@@ -558,16 +592,17 @@ export declare const union: {
|
|
| 558 |
* console.log(HashSet.size(common)) // 2
|
| 559 |
* ```
|
| 560 |
*
|
| 561 |
-
* @since 2.0.0
|
| 562 |
* @category combinators
|
|
|
|
| 563 |
*/
|
| 564 |
export declare const intersection: {
|
| 565 |
/**
|
| 566 |
* Creates the intersection of two HashSets.
|
| 567 |
*
|
| 568 |
-
*
|
|
|
|
| 569 |
* ```ts
|
| 570 |
-
* import
|
| 571 |
*
|
| 572 |
* const set1 = HashSet.make("a", "b", "c")
|
| 573 |
* const set2 = HashSet.make("b", "c", "d")
|
|
@@ -577,16 +612,17 @@ export declare const intersection: {
|
|
| 577 |
* console.log(HashSet.size(common)) // 2
|
| 578 |
* ```
|
| 579 |
*
|
| 580 |
-
* @since 2.0.0
|
| 581 |
* @category combinators
|
|
|
|
| 582 |
*/
|
| 583 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 & V0>;
|
| 584 |
/**
|
| 585 |
* Creates the intersection of two HashSets.
|
| 586 |
*
|
| 587 |
-
*
|
|
|
|
| 588 |
* ```ts
|
| 589 |
-
* import
|
| 590 |
*
|
| 591 |
* const set1 = HashSet.make("a", "b", "c")
|
| 592 |
* const set2 = HashSet.make("b", "c", "d")
|
|
@@ -596,17 +632,18 @@ export declare const intersection: {
|
|
| 596 |
* console.log(HashSet.size(common)) // 2
|
| 597 |
* ```
|
| 598 |
*
|
| 599 |
-
* @since 2.0.0
|
| 600 |
* @category combinators
|
|
|
|
| 601 |
*/
|
| 602 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 & V1>;
|
| 603 |
};
|
| 604 |
/**
|
| 605 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 606 |
*
|
| 607 |
-
*
|
|
|
|
| 608 |
* ```ts
|
| 609 |
-
* import
|
| 610 |
*
|
| 611 |
* const set1 = HashSet.make("a", "b", "c")
|
| 612 |
* const set2 = HashSet.make("b", "d")
|
|
@@ -616,16 +653,17 @@ export declare const intersection: {
|
|
| 616 |
* console.log(HashSet.size(diff)) // 2
|
| 617 |
* ```
|
| 618 |
*
|
| 619 |
-
* @since 2.0.0
|
| 620 |
* @category combinators
|
|
|
|
| 621 |
*/
|
| 622 |
export declare const difference: {
|
| 623 |
/**
|
| 624 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 625 |
*
|
| 626 |
-
*
|
|
|
|
| 627 |
* ```ts
|
| 628 |
-
* import
|
| 629 |
*
|
| 630 |
* const set1 = HashSet.make("a", "b", "c")
|
| 631 |
* const set2 = HashSet.make("b", "d")
|
|
@@ -635,16 +673,17 @@ export declare const difference: {
|
|
| 635 |
* console.log(HashSet.size(diff)) // 2
|
| 636 |
* ```
|
| 637 |
*
|
| 638 |
-
* @since 2.0.0
|
| 639 |
* @category combinators
|
|
|
|
| 640 |
*/
|
| 641 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V0>;
|
| 642 |
/**
|
| 643 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 644 |
*
|
| 645 |
-
*
|
|
|
|
| 646 |
* ```ts
|
| 647 |
-
* import
|
| 648 |
*
|
| 649 |
* const set1 = HashSet.make("a", "b", "c")
|
| 650 |
* const set2 = HashSet.make("b", "d")
|
|
@@ -654,17 +693,18 @@ export declare const difference: {
|
|
| 654 |
* console.log(HashSet.size(diff)) // 2
|
| 655 |
* ```
|
| 656 |
*
|
| 657 |
-
* @since 2.0.0
|
| 658 |
* @category combinators
|
|
|
|
| 659 |
*/
|
| 660 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0>;
|
| 661 |
};
|
| 662 |
/**
|
| 663 |
-
* Checks
|
|
|
|
|
|
|
| 664 |
*
|
| 665 |
-
* @example
|
| 666 |
* ```ts
|
| 667 |
-
* import
|
| 668 |
*
|
| 669 |
* const small = HashSet.make("a", "b")
|
| 670 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
@@ -676,16 +716,17 @@ export declare const difference: {
|
|
| 676 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 677 |
* ```
|
| 678 |
*
|
| 679 |
-
* @since 2.0.0
|
| 680 |
* @category elements
|
|
|
|
| 681 |
*/
|
| 682 |
export declare const isSubset: {
|
| 683 |
/**
|
| 684 |
-
* Checks
|
|
|
|
|
|
|
| 685 |
*
|
| 686 |
-
* @example
|
| 687 |
* ```ts
|
| 688 |
-
* import
|
| 689 |
*
|
| 690 |
* const small = HashSet.make("a", "b")
|
| 691 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
@@ -697,16 +738,17 @@ export declare const isSubset: {
|
|
| 697 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 698 |
* ```
|
| 699 |
*
|
| 700 |
-
* @since 2.0.0
|
| 701 |
* @category elements
|
|
|
|
| 702 |
*/
|
| 703 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => boolean;
|
| 704 |
/**
|
| 705 |
-
* Checks
|
|
|
|
|
|
|
| 706 |
*
|
| 707 |
-
* @example
|
| 708 |
* ```ts
|
| 709 |
-
* import
|
| 710 |
*
|
| 711 |
* const small = HashSet.make("a", "b")
|
| 712 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
@@ -718,17 +760,18 @@ export declare const isSubset: {
|
|
| 718 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 719 |
* ```
|
| 720 |
*
|
| 721 |
-
* @since 2.0.0
|
| 722 |
* @category elements
|
|
|
|
| 723 |
*/
|
| 724 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): boolean;
|
| 725 |
};
|
| 726 |
/**
|
| 727 |
* Maps each value in the HashSet using the provided function.
|
| 728 |
*
|
| 729 |
-
*
|
|
|
|
| 730 |
* ```ts
|
| 731 |
-
* import
|
| 732 |
*
|
| 733 |
* const numbers = HashSet.make(1, 2, 3)
|
| 734 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
@@ -742,16 +785,17 @@ export declare const isSubset: {
|
|
| 742 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 743 |
* ```
|
| 744 |
*
|
| 745 |
-
* @since 2.0.0
|
| 746 |
* @category mapping
|
|
|
|
| 747 |
*/
|
| 748 |
export declare const map: {
|
| 749 |
/**
|
| 750 |
* Maps each value in the HashSet using the provided function.
|
| 751 |
*
|
| 752 |
-
*
|
|
|
|
| 753 |
* ```ts
|
| 754 |
-
* import
|
| 755 |
*
|
| 756 |
* const numbers = HashSet.make(1, 2, 3)
|
| 757 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
@@ -765,16 +809,17 @@ export declare const map: {
|
|
| 765 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 766 |
* ```
|
| 767 |
*
|
| 768 |
-
* @since 2.0.0
|
| 769 |
* @category mapping
|
|
|
|
| 770 |
*/
|
| 771 |
<V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>;
|
| 772 |
/**
|
| 773 |
* Maps each value in the HashSet using the provided function.
|
| 774 |
*
|
| 775 |
-
*
|
|
|
|
| 776 |
* ```ts
|
| 777 |
-
* import
|
| 778 |
*
|
| 779 |
* const numbers = HashSet.make(1, 2, 3)
|
| 780 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
@@ -788,17 +833,18 @@ export declare const map: {
|
|
| 788 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 789 |
* ```
|
| 790 |
*
|
| 791 |
-
* @since 2.0.0
|
| 792 |
* @category mapping
|
|
|
|
| 793 |
*/
|
| 794 |
<V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>;
|
| 795 |
};
|
| 796 |
/**
|
| 797 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 798 |
*
|
| 799 |
-
*
|
|
|
|
| 800 |
* ```ts
|
| 801 |
-
* import
|
| 802 |
*
|
| 803 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 804 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -807,16 +853,17 @@ export declare const map: {
|
|
| 807 |
* console.log(HashSet.size(evens)) // 3
|
| 808 |
* ```
|
| 809 |
*
|
| 810 |
-
* @since 2.0.0
|
| 811 |
* @category filtering
|
|
|
|
| 812 |
*/
|
| 813 |
export declare const filter: {
|
| 814 |
/**
|
| 815 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 816 |
*
|
| 817 |
-
*
|
|
|
|
| 818 |
* ```ts
|
| 819 |
-
* import
|
| 820 |
*
|
| 821 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 822 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -825,16 +872,17 @@ export declare const filter: {
|
|
| 825 |
* console.log(HashSet.size(evens)) // 3
|
| 826 |
* ```
|
| 827 |
*
|
| 828 |
-
* @since 2.0.0
|
| 829 |
* @category filtering
|
|
|
|
| 830 |
*/
|
| 831 |
<V, U extends V>(refinement: Refinement<NoInfer<V>, U>): (self: HashSet<V>) => HashSet<U>;
|
| 832 |
/**
|
| 833 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 834 |
*
|
| 835 |
-
*
|
|
|
|
| 836 |
* ```ts
|
| 837 |
-
* import
|
| 838 |
*
|
| 839 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 840 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -843,16 +891,17 @@ export declare const filter: {
|
|
| 843 |
* console.log(HashSet.size(evens)) // 3
|
| 844 |
* ```
|
| 845 |
*
|
| 846 |
-
* @since 2.0.0
|
| 847 |
* @category filtering
|
|
|
|
| 848 |
*/
|
| 849 |
<V>(predicate: Predicate<NoInfer<V>>): (self: HashSet<V>) => HashSet<V>;
|
| 850 |
/**
|
| 851 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 852 |
*
|
| 853 |
-
*
|
|
|
|
| 854 |
* ```ts
|
| 855 |
-
* import
|
| 856 |
*
|
| 857 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 858 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -861,16 +910,17 @@ export declare const filter: {
|
|
| 861 |
* console.log(HashSet.size(evens)) // 3
|
| 862 |
* ```
|
| 863 |
*
|
| 864 |
-
* @since 2.0.0
|
| 865 |
* @category filtering
|
|
|
|
| 866 |
*/
|
| 867 |
<V, U extends V>(self: HashSet<V>, refinement: Refinement<V, U>): HashSet<U>;
|
| 868 |
/**
|
| 869 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 870 |
*
|
| 871 |
-
*
|
|
|
|
| 872 |
* ```ts
|
| 873 |
-
* import
|
| 874 |
*
|
| 875 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 876 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -879,17 +929,18 @@ export declare const filter: {
|
|
| 879 |
* console.log(HashSet.size(evens)) // 3
|
| 880 |
* ```
|
| 881 |
*
|
| 882 |
-
* @since 2.0.0
|
| 883 |
* @category filtering
|
|
|
|
| 884 |
*/
|
| 885 |
<V>(self: HashSet<V>, predicate: Predicate<V>): HashSet<V>;
|
| 886 |
};
|
| 887 |
/**
|
| 888 |
-
*
|
|
|
|
|
|
|
| 889 |
*
|
| 890 |
-
* @example
|
| 891 |
* ```ts
|
| 892 |
-
* import
|
| 893 |
*
|
| 894 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 895 |
*
|
|
@@ -900,16 +951,17 @@ export declare const filter: {
|
|
| 900 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 901 |
* ```
|
| 902 |
*
|
| 903 |
-
* @since 2.0.0
|
| 904 |
* @category elements
|
|
|
|
| 905 |
*/
|
| 906 |
export declare const some: {
|
| 907 |
/**
|
| 908 |
-
*
|
|
|
|
|
|
|
| 909 |
*
|
| 910 |
-
* @example
|
| 911 |
* ```ts
|
| 912 |
-
* import
|
| 913 |
*
|
| 914 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 915 |
*
|
|
@@ -920,16 +972,17 @@ export declare const some: {
|
|
| 920 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 921 |
* ```
|
| 922 |
*
|
| 923 |
-
* @since 2.0.0
|
| 924 |
* @category elements
|
|
|
|
| 925 |
*/
|
| 926 |
<V>(predicate: Predicate<V>): (self: HashSet<V>) => boolean;
|
| 927 |
/**
|
| 928 |
-
*
|
|
|
|
|
|
|
| 929 |
*
|
| 930 |
-
* @example
|
| 931 |
* ```ts
|
| 932 |
-
* import
|
| 933 |
*
|
| 934 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 935 |
*
|
|
@@ -940,17 +993,18 @@ export declare const some: {
|
|
| 940 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 941 |
* ```
|
| 942 |
*
|
| 943 |
-
* @since 2.0.0
|
| 944 |
* @category elements
|
|
|
|
| 945 |
*/
|
| 946 |
<V>(self: HashSet<V>, predicate: Predicate<V>): boolean;
|
| 947 |
};
|
| 948 |
/**
|
| 949 |
-
*
|
|
|
|
|
|
|
| 950 |
*
|
| 951 |
-
* @example
|
| 952 |
* ```ts
|
| 953 |
-
* import
|
| 954 |
*
|
| 955 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 956 |
*
|
|
@@ -961,16 +1015,17 @@ export declare const some: {
|
|
| 961 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 962 |
* ```
|
| 963 |
*
|
| 964 |
-
* @since 2.0.0
|
| 965 |
* @category elements
|
|
|
|
| 966 |
*/
|
| 967 |
export declare const every: {
|
| 968 |
/**
|
| 969 |
-
*
|
|
|
|
|
|
|
| 970 |
*
|
| 971 |
-
* @example
|
| 972 |
* ```ts
|
| 973 |
-
* import
|
| 974 |
*
|
| 975 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 976 |
*
|
|
@@ -981,16 +1036,17 @@ export declare const every: {
|
|
| 981 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 982 |
* ```
|
| 983 |
*
|
| 984 |
-
* @since 2.0.0
|
| 985 |
* @category elements
|
|
|
|
| 986 |
*/
|
| 987 |
<V>(predicate: Predicate<V>): (self: HashSet<V>) => boolean;
|
| 988 |
/**
|
| 989 |
-
*
|
|
|
|
|
|
|
| 990 |
*
|
| 991 |
-
* @example
|
| 992 |
* ```ts
|
| 993 |
-
* import
|
| 994 |
*
|
| 995 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 996 |
*
|
|
@@ -1001,17 +1057,18 @@ export declare const every: {
|
|
| 1001 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 1002 |
* ```
|
| 1003 |
*
|
| 1004 |
-
* @since 2.0.0
|
| 1005 |
* @category elements
|
|
|
|
| 1006 |
*/
|
| 1007 |
<V>(self: HashSet<V>, predicate: Predicate<V>): boolean;
|
| 1008 |
};
|
| 1009 |
/**
|
| 1010 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1011 |
*
|
| 1012 |
-
*
|
|
|
|
| 1013 |
* ```ts
|
| 1014 |
-
* import
|
| 1015 |
*
|
| 1016 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1017 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
@@ -1023,16 +1080,17 @@ export declare const every: {
|
|
| 1023 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1024 |
* ```
|
| 1025 |
*
|
| 1026 |
-
* @since 2.0.0
|
| 1027 |
* @category folding
|
|
|
|
| 1028 |
*/
|
| 1029 |
export declare const reduce: {
|
| 1030 |
/**
|
| 1031 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1032 |
*
|
| 1033 |
-
*
|
|
|
|
| 1034 |
* ```ts
|
| 1035 |
-
* import
|
| 1036 |
*
|
| 1037 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1038 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
@@ -1044,16 +1102,17 @@ export declare const reduce: {
|
|
| 1044 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1045 |
* ```
|
| 1046 |
*
|
| 1047 |
-
* @since 2.0.0
|
| 1048 |
* @category folding
|
|
|
|
| 1049 |
*/
|
| 1050 |
<V, U>(zero: U, f: (accumulator: U, value: V) => U): (self: HashSet<V>) => U;
|
| 1051 |
/**
|
| 1052 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1053 |
*
|
| 1054 |
-
*
|
|
|
|
| 1055 |
* ```ts
|
| 1056 |
-
* import
|
| 1057 |
*
|
| 1058 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1059 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
@@ -1065,8 +1124,8 @@ export declare const reduce: {
|
|
| 1065 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1066 |
* ```
|
| 1067 |
*
|
| 1068 |
-
* @since 2.0.0
|
| 1069 |
* @category folding
|
|
|
|
| 1070 |
*/
|
| 1071 |
<V, U>(self: HashSet<V>, zero: U, f: (accumulator: U, value: V) => U): U;
|
| 1072 |
};
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Stores unique values in an immutable hash set.
|
| 3 |
+
*
|
| 4 |
+
* A `HashSet<A>` contains at most one value for each equality class according
|
| 5 |
+
* to Effect's `Equal` and `Hash` rules. Membership checks, additions, removals,
|
| 6 |
+
* and set operations return new sets. This module also includes constructors,
|
| 7 |
+
* union, intersection, difference, subset checks, mapping, filtering, and
|
| 8 |
+
* reducing helpers.
|
| 9 |
+
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
| 12 |
import type { Equal } from "./Equal.ts";
|
|
|
|
| 19 |
* A HashSet is an immutable set data structure that provides efficient storage
|
| 20 |
* and retrieval of unique values. It uses a HashMap internally for optimal performance.
|
| 21 |
*
|
| 22 |
+
* **Example** (Creating and updating a HashSet)
|
| 23 |
+
*
|
| 24 |
* ```ts
|
| 25 |
+
* import { HashSet } from "effect"
|
| 26 |
*
|
| 27 |
* // Create a HashSet
|
| 28 |
* const set = HashSet.make("apple", "banana", "cherry")
|
|
|
|
| 40 |
* console.log(HashSet.size(smaller)) // 2
|
| 41 |
* ```
|
| 42 |
*
|
|
|
|
| 43 |
* @category models
|
| 44 |
+
* @since 2.0.0
|
| 45 |
*/
|
| 46 |
export interface HashSet<out Value> extends Iterable<Value>, Equal, Pipeable, Inspectable {
|
| 47 |
readonly [TypeId]: typeof TypeId;
|
|
|
|
| 50 |
* The HashSet namespace contains type-level utilities and helper types
|
| 51 |
* for working with HashSet instances.
|
| 52 |
*
|
| 53 |
+
* **Example** (Extracting value types from a HashSet)
|
| 54 |
+
*
|
| 55 |
* ```ts
|
| 56 |
+
* import { HashSet } from "effect"
|
| 57 |
*
|
| 58 |
* // Create a concrete HashSet for type extraction
|
| 59 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
|
|
|
| 68 |
* ```
|
| 69 |
*
|
| 70 |
* @since 2.0.0
|
|
|
|
| 71 |
*/
|
| 72 |
export declare namespace HashSet {
|
| 73 |
/**
|
| 74 |
+
* Extracts the element type from a `HashSet`.
|
| 75 |
+
*
|
| 76 |
+
* **Details**
|
| 77 |
+
*
|
| 78 |
+
* For `HashSet.HashSet<A>`, `HashSet.Value<...>` resolves to `A`.
|
| 79 |
+
*
|
| 80 |
+
* **Example** (Extracting a HashSet value type)
|
| 81 |
+
*
|
| 82 |
* ```ts
|
| 83 |
+
* import { HashSet } from "effect"
|
| 84 |
*
|
| 85 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 86 |
*
|
|
|
|
| 90 |
* const processNumber = (n: NumberType) => n * 2
|
| 91 |
* ```
|
| 92 |
*
|
| 93 |
+
* @category utility types
|
| 94 |
+
* @since 4.0.0
|
| 95 |
*/
|
| 96 |
type Value<T> = T extends HashSet<infer V> ? V : never;
|
| 97 |
}
|
| 98 |
/**
|
| 99 |
* Creates an empty HashSet.
|
| 100 |
*
|
| 101 |
+
* **Example** (Creating an empty HashSet)
|
| 102 |
+
*
|
| 103 |
* ```ts
|
| 104 |
+
* import { HashSet } from "effect"
|
| 105 |
*
|
| 106 |
* const set = HashSet.empty<string>()
|
| 107 |
*
|
|
|
|
| 113 |
* console.log(HashSet.size(withValues)) // 2
|
| 114 |
* ```
|
| 115 |
*
|
|
|
|
| 116 |
* @category constructors
|
| 117 |
+
* @since 2.0.0
|
| 118 |
*/
|
| 119 |
export declare const empty: <V = never>() => HashSet<V>;
|
| 120 |
/**
|
| 121 |
* Creates a HashSet from a variable number of values.
|
| 122 |
*
|
| 123 |
+
* **Example** (Creating a HashSet from values)
|
| 124 |
+
*
|
| 125 |
* ```ts
|
| 126 |
+
* import { HashSet } from "effect"
|
| 127 |
*
|
| 128 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
| 129 |
* console.log(HashSet.size(fruits)) // 3
|
|
|
|
| 135 |
* console.log(HashSet.size(mixed)) // 3
|
| 136 |
* ```
|
| 137 |
*
|
|
|
|
| 138 |
* @category constructors
|
| 139 |
+
* @since 2.0.0
|
| 140 |
*/
|
| 141 |
export declare const make: <Values extends ReadonlyArray<any>>(...values: Values) => HashSet<Values[number]>;
|
| 142 |
/**
|
| 143 |
* Creates a HashSet from an iterable collection of values.
|
| 144 |
*
|
| 145 |
+
* **Example** (Creating a HashSet from an iterable)
|
| 146 |
+
*
|
| 147 |
* ```ts
|
| 148 |
+
* import { HashSet } from "effect"
|
| 149 |
*
|
| 150 |
* const fromArray = HashSet.fromIterable(["a", "b", "c", "b", "a"])
|
| 151 |
* console.log(HashSet.size(fromArray)) // 3
|
|
|
|
| 157 |
* console.log(Array.from(fromString)) // ["h", "e", "l", "o"]
|
| 158 |
* ```
|
| 159 |
*
|
|
|
|
| 160 |
* @category constructors
|
| 161 |
+
* @since 2.0.0
|
| 162 |
*/
|
| 163 |
export declare const fromIterable: <V>(values: Iterable<V>) => HashSet<V>;
|
| 164 |
/**
|
| 165 |
+
* Checks whether a value is a HashSet.
|
| 166 |
+
*
|
| 167 |
+
* **Example** (Checking for a HashSet)
|
| 168 |
*
|
|
|
|
| 169 |
* ```ts
|
| 170 |
+
* import { HashSet } from "effect"
|
| 171 |
*
|
| 172 |
* const set = HashSet.make(1, 2, 3)
|
| 173 |
* const array = [1, 2, 3]
|
|
|
|
| 177 |
* console.log(HashSet.isHashSet(null)) // false
|
| 178 |
* ```
|
| 179 |
*
|
|
|
|
| 180 |
* @category guards
|
| 181 |
+
* @since 2.0.0
|
| 182 |
*/
|
| 183 |
export declare const isHashSet: {
|
| 184 |
/**
|
| 185 |
+
* Checks whether a value is a HashSet.
|
| 186 |
+
*
|
| 187 |
+
* **Example** (Checking for a HashSet)
|
| 188 |
*
|
|
|
|
| 189 |
* ```ts
|
| 190 |
+
* import { HashSet } from "effect"
|
| 191 |
*
|
| 192 |
* const set = HashSet.make(1, 2, 3)
|
| 193 |
* const array = [1, 2, 3]
|
|
|
|
| 197 |
* console.log(HashSet.isHashSet(null)) // false
|
| 198 |
* ```
|
| 199 |
*
|
|
|
|
| 200 |
* @category guards
|
| 201 |
+
* @since 2.0.0
|
| 202 |
*/
|
| 203 |
<V>(u: Iterable<V>): u is HashSet<V>;
|
| 204 |
/**
|
| 205 |
+
* Checks whether a value is a HashSet.
|
| 206 |
+
*
|
| 207 |
+
* **Example** (Checking for a HashSet)
|
| 208 |
*
|
|
|
|
| 209 |
* ```ts
|
| 210 |
+
* import { HashSet } from "effect"
|
| 211 |
*
|
| 212 |
* const set = HashSet.make(1, 2, 3)
|
| 213 |
* const array = [1, 2, 3]
|
|
|
|
| 217 |
* console.log(HashSet.isHashSet(null)) // false
|
| 218 |
* ```
|
| 219 |
*
|
|
|
|
| 220 |
* @category guards
|
| 221 |
+
* @since 2.0.0
|
| 222 |
*/
|
| 223 |
(u: unknown): u is HashSet<unknown>;
|
| 224 |
};
|
| 225 |
/**
|
| 226 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 227 |
*
|
| 228 |
+
* **Example** (Adding values to a HashSet)
|
| 229 |
+
*
|
| 230 |
* ```ts
|
| 231 |
+
* import { HashSet } from "effect"
|
| 232 |
*
|
| 233 |
* const set = HashSet.make("a", "b")
|
| 234 |
* const withC = HashSet.add(set, "c")
|
|
|
|
| 242 |
* console.log(HashSet.size(same)) // 2
|
| 243 |
* ```
|
| 244 |
*
|
|
|
|
| 245 |
* @category mutations
|
| 246 |
+
* @since 2.0.0
|
| 247 |
*/
|
| 248 |
export declare const add: {
|
| 249 |
/**
|
| 250 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 251 |
*
|
| 252 |
+
* **Example** (Adding values to a HashSet)
|
| 253 |
+
*
|
| 254 |
* ```ts
|
| 255 |
+
* import { HashSet } from "effect"
|
| 256 |
*
|
| 257 |
* const set = HashSet.make("a", "b")
|
| 258 |
* const withC = HashSet.add(set, "c")
|
|
|
|
| 266 |
* console.log(HashSet.size(same)) // 2
|
| 267 |
* ```
|
| 268 |
*
|
|
|
|
| 269 |
* @category mutations
|
| 270 |
+
* @since 2.0.0
|
| 271 |
*/
|
| 272 |
<V>(value: V): (self: HashSet<V>) => HashSet<V>;
|
| 273 |
/**
|
| 274 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 275 |
*
|
| 276 |
+
* **Example** (Adding values to a HashSet)
|
| 277 |
+
*
|
| 278 |
* ```ts
|
| 279 |
+
* import { HashSet } from "effect"
|
| 280 |
*
|
| 281 |
* const set = HashSet.make("a", "b")
|
| 282 |
* const withC = HashSet.add(set, "c")
|
|
|
|
| 290 |
* console.log(HashSet.size(same)) // 2
|
| 291 |
* ```
|
| 292 |
*
|
|
|
|
| 293 |
* @category mutations
|
| 294 |
+
* @since 2.0.0
|
| 295 |
*/
|
| 296 |
<V>(self: HashSet<V>, value: V): HashSet<V>;
|
| 297 |
};
|
| 298 |
/**
|
| 299 |
+
* Checks whether the HashSet contains the specified value.
|
| 300 |
+
*
|
| 301 |
+
* **Example** (Checking HashSet membership)
|
| 302 |
*
|
|
|
|
| 303 |
* ```ts
|
| 304 |
+
* import { Equal, Hash, HashSet } from "effect"
|
| 305 |
*
|
| 306 |
* // Works with any type that implements Equal
|
|
|
|
| 307 |
*
|
| 308 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 309 |
*
|
| 310 |
* console.log(HashSet.has(set, "apple")) // true
|
| 311 |
+
* console.log(HashSet.has(set, "grape")) // false
|
| 312 |
*
|
| 313 |
* class Person implements Equal.Equal {
|
| 314 |
* constructor(readonly name: string) {}
|
|
|
|
| 326 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 327 |
* ```
|
| 328 |
*
|
|
|
|
| 329 |
* @category elements
|
| 330 |
+
* @since 2.0.0
|
| 331 |
*/
|
| 332 |
export declare const has: {
|
| 333 |
/**
|
| 334 |
+
* Checks whether the HashSet contains the specified value.
|
| 335 |
+
*
|
| 336 |
+
* **Example** (Checking HashSet membership)
|
| 337 |
*
|
|
|
|
| 338 |
* ```ts
|
| 339 |
+
* import { Equal, Hash, HashSet } from "effect"
|
| 340 |
*
|
| 341 |
* // Works with any type that implements Equal
|
|
|
|
| 342 |
*
|
| 343 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 344 |
*
|
| 345 |
* console.log(HashSet.has(set, "apple")) // true
|
| 346 |
+
* console.log(HashSet.has(set, "grape")) // false
|
| 347 |
*
|
| 348 |
* class Person implements Equal.Equal {
|
| 349 |
* constructor(readonly name: string) {}
|
|
|
|
| 361 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 362 |
* ```
|
| 363 |
*
|
|
|
|
| 364 |
* @category elements
|
| 365 |
+
* @since 2.0.0
|
| 366 |
*/
|
| 367 |
<V>(value: V): (self: HashSet<V>) => boolean;
|
| 368 |
/**
|
| 369 |
+
* Checks whether the HashSet contains the specified value.
|
| 370 |
+
*
|
| 371 |
+
* **Example** (Checking HashSet membership)
|
| 372 |
*
|
|
|
|
| 373 |
* ```ts
|
| 374 |
+
* import { Equal, Hash, HashSet } from "effect"
|
| 375 |
*
|
| 376 |
* // Works with any type that implements Equal
|
|
|
|
| 377 |
*
|
| 378 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 379 |
*
|
| 380 |
* console.log(HashSet.has(set, "apple")) // true
|
| 381 |
+
* console.log(HashSet.has(set, "grape")) // false
|
| 382 |
*
|
| 383 |
* class Person implements Equal.Equal {
|
| 384 |
* constructor(readonly name: string) {}
|
|
|
|
| 396 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 397 |
* ```
|
| 398 |
*
|
|
|
|
| 399 |
* @category elements
|
| 400 |
+
* @since 2.0.0
|
| 401 |
*/
|
| 402 |
<V>(self: HashSet<V>, value: V): boolean;
|
| 403 |
};
|
| 404 |
/**
|
| 405 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 406 |
*
|
| 407 |
+
* **Example** (Removing values from a HashSet)
|
| 408 |
+
*
|
| 409 |
* ```ts
|
| 410 |
+
* import { HashSet } from "effect"
|
| 411 |
*
|
| 412 |
* const set = HashSet.make("a", "b", "c")
|
| 413 |
* const withoutB = HashSet.remove(set, "b")
|
|
|
|
| 421 |
* console.log(HashSet.size(same)) // 3
|
| 422 |
* ```
|
| 423 |
*
|
|
|
|
| 424 |
* @category mutations
|
| 425 |
+
* @since 2.0.0
|
| 426 |
*/
|
| 427 |
export declare const remove: {
|
| 428 |
/**
|
| 429 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 430 |
*
|
| 431 |
+
* **Example** (Removing values from a HashSet)
|
| 432 |
+
*
|
| 433 |
* ```ts
|
| 434 |
+
* import { HashSet } from "effect"
|
| 435 |
*
|
| 436 |
* const set = HashSet.make("a", "b", "c")
|
| 437 |
* const withoutB = HashSet.remove(set, "b")
|
|
|
|
| 445 |
* console.log(HashSet.size(same)) // 3
|
| 446 |
* ```
|
| 447 |
*
|
|
|
|
| 448 |
* @category mutations
|
| 449 |
+
* @since 2.0.0
|
| 450 |
*/
|
| 451 |
<V>(value: V): (self: HashSet<V>) => HashSet<V>;
|
| 452 |
/**
|
| 453 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 454 |
*
|
| 455 |
+
* **Example** (Removing values from a HashSet)
|
| 456 |
+
*
|
| 457 |
* ```ts
|
| 458 |
+
* import { HashSet } from "effect"
|
| 459 |
*
|
| 460 |
* const set = HashSet.make("a", "b", "c")
|
| 461 |
* const withoutB = HashSet.remove(set, "b")
|
|
|
|
| 469 |
* console.log(HashSet.size(same)) // 3
|
| 470 |
* ```
|
| 471 |
*
|
|
|
|
| 472 |
* @category mutations
|
| 473 |
+
* @since 2.0.0
|
| 474 |
*/
|
| 475 |
<V>(self: HashSet<V>, value: V): HashSet<V>;
|
| 476 |
};
|
| 477 |
/**
|
| 478 |
* Returns the number of values in the HashSet.
|
| 479 |
*
|
| 480 |
+
* **Example** (Getting the HashSet size)
|
| 481 |
+
*
|
| 482 |
* ```ts
|
| 483 |
+
* import { HashSet } from "effect"
|
| 484 |
*
|
| 485 |
* const empty = HashSet.empty<string>()
|
| 486 |
* console.log(HashSet.size(empty)) // 0
|
|
|
|
| 492 |
* console.log(HashSet.size(withDuplicates)) // 3
|
| 493 |
* ```
|
| 494 |
*
|
|
|
|
| 495 |
* @category getters
|
| 496 |
+
* @since 2.0.0
|
| 497 |
*/
|
| 498 |
export declare const size: <V>(self: HashSet<V>) => number;
|
| 499 |
/**
|
| 500 |
+
* Checks whether the HashSet is empty.
|
| 501 |
+
*
|
| 502 |
+
* **Example** (Checking whether a HashSet is empty)
|
| 503 |
*
|
|
|
|
| 504 |
* ```ts
|
| 505 |
+
* import { HashSet } from "effect"
|
| 506 |
*
|
| 507 |
* const empty = HashSet.empty<string>()
|
| 508 |
* console.log(HashSet.isEmpty(empty)) // true
|
|
|
|
| 511 |
* console.log(HashSet.isEmpty(nonEmpty)) // false
|
| 512 |
* ```
|
| 513 |
*
|
|
|
|
| 514 |
* @category getters
|
| 515 |
+
* @since 4.0.0
|
| 516 |
*/
|
| 517 |
export declare const isEmpty: <V>(self: HashSet<V>) => boolean;
|
| 518 |
/**
|
| 519 |
* Creates the union of two HashSets.
|
| 520 |
*
|
| 521 |
+
* **Example** (Combining HashSets)
|
| 522 |
+
*
|
| 523 |
* ```ts
|
| 524 |
+
* import { HashSet } from "effect"
|
| 525 |
*
|
| 526 |
* const set1 = HashSet.make("a", "b")
|
| 527 |
* const set2 = HashSet.make("b", "c")
|
|
|
|
| 531 |
* console.log(HashSet.size(combined)) // 3
|
| 532 |
* ```
|
| 533 |
*
|
|
|
|
| 534 |
* @category combinators
|
| 535 |
+
* @since 2.0.0
|
| 536 |
*/
|
| 537 |
export declare const union: {
|
| 538 |
/**
|
| 539 |
* Creates the union of two HashSets.
|
| 540 |
*
|
| 541 |
+
* **Example** (Combining HashSets)
|
| 542 |
+
*
|
| 543 |
* ```ts
|
| 544 |
+
* import { HashSet } from "effect"
|
| 545 |
*
|
| 546 |
* const set1 = HashSet.make("a", "b")
|
| 547 |
* const set2 = HashSet.make("b", "c")
|
|
|
|
| 551 |
* console.log(HashSet.size(combined)) // 3
|
| 552 |
* ```
|
| 553 |
*
|
|
|
|
| 554 |
* @category combinators
|
| 555 |
+
* @since 2.0.0
|
| 556 |
*/
|
| 557 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 | V0>;
|
| 558 |
/**
|
| 559 |
* Creates the union of two HashSets.
|
| 560 |
*
|
| 561 |
+
* **Example** (Combining HashSets)
|
| 562 |
+
*
|
| 563 |
* ```ts
|
| 564 |
+
* import { HashSet } from "effect"
|
| 565 |
*
|
| 566 |
* const set1 = HashSet.make("a", "b")
|
| 567 |
* const set2 = HashSet.make("b", "c")
|
|
|
|
| 571 |
* console.log(HashSet.size(combined)) // 3
|
| 572 |
* ```
|
| 573 |
*
|
|
|
|
| 574 |
* @category combinators
|
| 575 |
+
* @since 2.0.0
|
| 576 |
*/
|
| 577 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 | V1>;
|
| 578 |
};
|
| 579 |
/**
|
| 580 |
* Creates the intersection of two HashSets.
|
| 581 |
*
|
| 582 |
+
* **Example** (Finding common HashSet values)
|
| 583 |
+
*
|
| 584 |
* ```ts
|
| 585 |
+
* import { HashSet } from "effect"
|
| 586 |
*
|
| 587 |
* const set1 = HashSet.make("a", "b", "c")
|
| 588 |
* const set2 = HashSet.make("b", "c", "d")
|
|
|
|
| 592 |
* console.log(HashSet.size(common)) // 2
|
| 593 |
* ```
|
| 594 |
*
|
|
|
|
| 595 |
* @category combinators
|
| 596 |
+
* @since 2.0.0
|
| 597 |
*/
|
| 598 |
export declare const intersection: {
|
| 599 |
/**
|
| 600 |
* Creates the intersection of two HashSets.
|
| 601 |
*
|
| 602 |
+
* **Example** (Finding common HashSet values)
|
| 603 |
+
*
|
| 604 |
* ```ts
|
| 605 |
+
* import { HashSet } from "effect"
|
| 606 |
*
|
| 607 |
* const set1 = HashSet.make("a", "b", "c")
|
| 608 |
* const set2 = HashSet.make("b", "c", "d")
|
|
|
|
| 612 |
* console.log(HashSet.size(common)) // 2
|
| 613 |
* ```
|
| 614 |
*
|
|
|
|
| 615 |
* @category combinators
|
| 616 |
+
* @since 2.0.0
|
| 617 |
*/
|
| 618 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V1 & V0>;
|
| 619 |
/**
|
| 620 |
* Creates the intersection of two HashSets.
|
| 621 |
*
|
| 622 |
+
* **Example** (Finding common HashSet values)
|
| 623 |
+
*
|
| 624 |
* ```ts
|
| 625 |
+
* import { HashSet } from "effect"
|
| 626 |
*
|
| 627 |
* const set1 = HashSet.make("a", "b", "c")
|
| 628 |
* const set2 = HashSet.make("b", "c", "d")
|
|
|
|
| 632 |
* console.log(HashSet.size(common)) // 2
|
| 633 |
* ```
|
| 634 |
*
|
|
|
|
| 635 |
* @category combinators
|
| 636 |
+
* @since 2.0.0
|
| 637 |
*/
|
| 638 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 & V1>;
|
| 639 |
};
|
| 640 |
/**
|
| 641 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 642 |
*
|
| 643 |
+
* **Example** (Finding HashSet differences)
|
| 644 |
+
*
|
| 645 |
* ```ts
|
| 646 |
+
* import { HashSet } from "effect"
|
| 647 |
*
|
| 648 |
* const set1 = HashSet.make("a", "b", "c")
|
| 649 |
* const set2 = HashSet.make("b", "d")
|
|
|
|
| 653 |
* console.log(HashSet.size(diff)) // 2
|
| 654 |
* ```
|
| 655 |
*
|
|
|
|
| 656 |
* @category combinators
|
| 657 |
+
* @since 2.0.0
|
| 658 |
*/
|
| 659 |
export declare const difference: {
|
| 660 |
/**
|
| 661 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 662 |
*
|
| 663 |
+
* **Example** (Finding HashSet differences)
|
| 664 |
+
*
|
| 665 |
* ```ts
|
| 666 |
+
* import { HashSet } from "effect"
|
| 667 |
*
|
| 668 |
* const set1 = HashSet.make("a", "b", "c")
|
| 669 |
* const set2 = HashSet.make("b", "d")
|
|
|
|
| 673 |
* console.log(HashSet.size(diff)) // 2
|
| 674 |
* ```
|
| 675 |
*
|
|
|
|
| 676 |
* @category combinators
|
| 677 |
+
* @since 2.0.0
|
| 678 |
*/
|
| 679 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => HashSet<V0>;
|
| 680 |
/**
|
| 681 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 682 |
*
|
| 683 |
+
* **Example** (Finding HashSet differences)
|
| 684 |
+
*
|
| 685 |
* ```ts
|
| 686 |
+
* import { HashSet } from "effect"
|
| 687 |
*
|
| 688 |
* const set1 = HashSet.make("a", "b", "c")
|
| 689 |
* const set2 = HashSet.make("b", "d")
|
|
|
|
| 693 |
* console.log(HashSet.size(diff)) // 2
|
| 694 |
* ```
|
| 695 |
*
|
|
|
|
| 696 |
* @category combinators
|
| 697 |
+
* @since 2.0.0
|
| 698 |
*/
|
| 699 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0>;
|
| 700 |
};
|
| 701 |
/**
|
| 702 |
+
* Checks whether a HashSet is a subset of another HashSet.
|
| 703 |
+
*
|
| 704 |
+
* **Example** (Checking subset relationships)
|
| 705 |
*
|
|
|
|
| 706 |
* ```ts
|
| 707 |
+
* import { HashSet } from "effect"
|
| 708 |
*
|
| 709 |
* const small = HashSet.make("a", "b")
|
| 710 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
|
|
| 716 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 717 |
* ```
|
| 718 |
*
|
|
|
|
| 719 |
* @category elements
|
| 720 |
+
* @since 2.0.0
|
| 721 |
*/
|
| 722 |
export declare const isSubset: {
|
| 723 |
/**
|
| 724 |
+
* Checks whether a HashSet is a subset of another HashSet.
|
| 725 |
+
*
|
| 726 |
+
* **Example** (Checking subset relationships)
|
| 727 |
*
|
|
|
|
| 728 |
* ```ts
|
| 729 |
+
* import { HashSet } from "effect"
|
| 730 |
*
|
| 731 |
* const small = HashSet.make("a", "b")
|
| 732 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
|
|
| 738 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 739 |
* ```
|
| 740 |
*
|
|
|
|
| 741 |
* @category elements
|
| 742 |
+
* @since 2.0.0
|
| 743 |
*/
|
| 744 |
<V1>(that: HashSet<V1>): <V0>(self: HashSet<V0>) => boolean;
|
| 745 |
/**
|
| 746 |
+
* Checks whether a HashSet is a subset of another HashSet.
|
| 747 |
+
*
|
| 748 |
+
* **Example** (Checking subset relationships)
|
| 749 |
*
|
|
|
|
| 750 |
* ```ts
|
| 751 |
+
* import { HashSet } from "effect"
|
| 752 |
*
|
| 753 |
* const small = HashSet.make("a", "b")
|
| 754 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
|
|
| 760 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 761 |
* ```
|
| 762 |
*
|
|
|
|
| 763 |
* @category elements
|
| 764 |
+
* @since 2.0.0
|
| 765 |
*/
|
| 766 |
<V0, V1>(self: HashSet<V0>, that: HashSet<V1>): boolean;
|
| 767 |
};
|
| 768 |
/**
|
| 769 |
* Maps each value in the HashSet using the provided function.
|
| 770 |
*
|
| 771 |
+
* **Example** (Mapping HashSet values)
|
| 772 |
+
*
|
| 773 |
* ```ts
|
| 774 |
+
* import { HashSet } from "effect"
|
| 775 |
*
|
| 776 |
* const numbers = HashSet.make(1, 2, 3)
|
| 777 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
|
|
| 785 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 786 |
* ```
|
| 787 |
*
|
|
|
|
| 788 |
* @category mapping
|
| 789 |
+
* @since 2.0.0
|
| 790 |
*/
|
| 791 |
export declare const map: {
|
| 792 |
/**
|
| 793 |
* Maps each value in the HashSet using the provided function.
|
| 794 |
*
|
| 795 |
+
* **Example** (Mapping HashSet values)
|
| 796 |
+
*
|
| 797 |
* ```ts
|
| 798 |
+
* import { HashSet } from "effect"
|
| 799 |
*
|
| 800 |
* const numbers = HashSet.make(1, 2, 3)
|
| 801 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
|
|
| 809 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 810 |
* ```
|
| 811 |
*
|
|
|
|
| 812 |
* @category mapping
|
| 813 |
+
* @since 2.0.0
|
| 814 |
*/
|
| 815 |
<V, U>(f: (value: V) => U): (self: HashSet<V>) => HashSet<U>;
|
| 816 |
/**
|
| 817 |
* Maps each value in the HashSet using the provided function.
|
| 818 |
*
|
| 819 |
+
* **Example** (Mapping HashSet values)
|
| 820 |
+
*
|
| 821 |
* ```ts
|
| 822 |
+
* import { HashSet } from "effect"
|
| 823 |
*
|
| 824 |
* const numbers = HashSet.make(1, 2, 3)
|
| 825 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
|
|
| 833 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 834 |
* ```
|
| 835 |
*
|
|
|
|
| 836 |
* @category mapping
|
| 837 |
+
* @since 2.0.0
|
| 838 |
*/
|
| 839 |
<V, U>(self: HashSet<V>, f: (value: V) => U): HashSet<U>;
|
| 840 |
};
|
| 841 |
/**
|
| 842 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 843 |
*
|
| 844 |
+
* **Example** (Filtering HashSet values)
|
| 845 |
+
*
|
| 846 |
* ```ts
|
| 847 |
+
* import { HashSet } from "effect"
|
| 848 |
*
|
| 849 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 850 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 853 |
* console.log(HashSet.size(evens)) // 3
|
| 854 |
* ```
|
| 855 |
*
|
|
|
|
| 856 |
* @category filtering
|
| 857 |
+
* @since 2.0.0
|
| 858 |
*/
|
| 859 |
export declare const filter: {
|
| 860 |
/**
|
| 861 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 862 |
*
|
| 863 |
+
* **Example** (Filtering HashSet values)
|
| 864 |
+
*
|
| 865 |
* ```ts
|
| 866 |
+
* import { HashSet } from "effect"
|
| 867 |
*
|
| 868 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 869 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 872 |
* console.log(HashSet.size(evens)) // 3
|
| 873 |
* ```
|
| 874 |
*
|
|
|
|
| 875 |
* @category filtering
|
| 876 |
+
* @since 2.0.0
|
| 877 |
*/
|
| 878 |
<V, U extends V>(refinement: Refinement<NoInfer<V>, U>): (self: HashSet<V>) => HashSet<U>;
|
| 879 |
/**
|
| 880 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 881 |
*
|
| 882 |
+
* **Example** (Filtering HashSet values)
|
| 883 |
+
*
|
| 884 |
* ```ts
|
| 885 |
+
* import { HashSet } from "effect"
|
| 886 |
*
|
| 887 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 888 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 891 |
* console.log(HashSet.size(evens)) // 3
|
| 892 |
* ```
|
| 893 |
*
|
|
|
|
| 894 |
* @category filtering
|
| 895 |
+
* @since 2.0.0
|
| 896 |
*/
|
| 897 |
<V>(predicate: Predicate<NoInfer<V>>): (self: HashSet<V>) => HashSet<V>;
|
| 898 |
/**
|
| 899 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 900 |
*
|
| 901 |
+
* **Example** (Filtering HashSet values)
|
| 902 |
+
*
|
| 903 |
* ```ts
|
| 904 |
+
* import { HashSet } from "effect"
|
| 905 |
*
|
| 906 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 907 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 910 |
* console.log(HashSet.size(evens)) // 3
|
| 911 |
* ```
|
| 912 |
*
|
|
|
|
| 913 |
* @category filtering
|
| 914 |
+
* @since 2.0.0
|
| 915 |
*/
|
| 916 |
<V, U extends V>(self: HashSet<V>, refinement: Refinement<V, U>): HashSet<U>;
|
| 917 |
/**
|
| 918 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 919 |
*
|
| 920 |
+
* **Example** (Filtering HashSet values)
|
| 921 |
+
*
|
| 922 |
* ```ts
|
| 923 |
+
* import { HashSet } from "effect"
|
| 924 |
*
|
| 925 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 926 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 929 |
* console.log(HashSet.size(evens)) // 3
|
| 930 |
* ```
|
| 931 |
*
|
|
|
|
| 932 |
* @category filtering
|
| 933 |
+
* @since 2.0.0
|
| 934 |
*/
|
| 935 |
<V>(self: HashSet<V>, predicate: Predicate<V>): HashSet<V>;
|
| 936 |
};
|
| 937 |
/**
|
| 938 |
+
* Checks whether at least one value in the HashSet satisfies the predicate.
|
| 939 |
+
*
|
| 940 |
+
* **Example** (Testing whether some values match)
|
| 941 |
*
|
|
|
|
| 942 |
* ```ts
|
| 943 |
+
* import { HashSet } from "effect"
|
| 944 |
*
|
| 945 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 946 |
*
|
|
|
|
| 951 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 952 |
* ```
|
| 953 |
*
|
|
|
|
| 954 |
* @category elements
|
| 955 |
+
* @since 2.0.0
|
| 956 |
*/
|
| 957 |
export declare const some: {
|
| 958 |
/**
|
| 959 |
+
* Checks whether at least one value in the HashSet satisfies the predicate.
|
| 960 |
+
*
|
| 961 |
+
* **Example** (Testing whether some values match)
|
| 962 |
*
|
|
|
|
| 963 |
* ```ts
|
| 964 |
+
* import { HashSet } from "effect"
|
| 965 |
*
|
| 966 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 967 |
*
|
|
|
|
| 972 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 973 |
* ```
|
| 974 |
*
|
|
|
|
| 975 |
* @category elements
|
| 976 |
+
* @since 2.0.0
|
| 977 |
*/
|
| 978 |
<V>(predicate: Predicate<V>): (self: HashSet<V>) => boolean;
|
| 979 |
/**
|
| 980 |
+
* Checks whether at least one value in the HashSet satisfies the predicate.
|
| 981 |
+
*
|
| 982 |
+
* **Example** (Testing whether some values match)
|
| 983 |
*
|
|
|
|
| 984 |
* ```ts
|
| 985 |
+
* import { HashSet } from "effect"
|
| 986 |
*
|
| 987 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 988 |
*
|
|
|
|
| 993 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 994 |
* ```
|
| 995 |
*
|
|
|
|
| 996 |
* @category elements
|
| 997 |
+
* @since 2.0.0
|
| 998 |
*/
|
| 999 |
<V>(self: HashSet<V>, predicate: Predicate<V>): boolean;
|
| 1000 |
};
|
| 1001 |
/**
|
| 1002 |
+
* Checks whether all values in the HashSet satisfy the predicate.
|
| 1003 |
+
*
|
| 1004 |
+
* **Example** (Testing whether every value matches)
|
| 1005 |
*
|
|
|
|
| 1006 |
* ```ts
|
| 1007 |
+
* import { HashSet } from "effect"
|
| 1008 |
*
|
| 1009 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 1010 |
*
|
|
|
|
| 1015 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 1016 |
* ```
|
| 1017 |
*
|
|
|
|
| 1018 |
* @category elements
|
| 1019 |
+
* @since 2.0.0
|
| 1020 |
*/
|
| 1021 |
export declare const every: {
|
| 1022 |
/**
|
| 1023 |
+
* Checks whether all values in the HashSet satisfy the predicate.
|
| 1024 |
+
*
|
| 1025 |
+
* **Example** (Testing whether every value matches)
|
| 1026 |
*
|
|
|
|
| 1027 |
* ```ts
|
| 1028 |
+
* import { HashSet } from "effect"
|
| 1029 |
*
|
| 1030 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 1031 |
*
|
|
|
|
| 1036 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 1037 |
* ```
|
| 1038 |
*
|
|
|
|
| 1039 |
* @category elements
|
| 1040 |
+
* @since 2.0.0
|
| 1041 |
*/
|
| 1042 |
<V>(predicate: Predicate<V>): (self: HashSet<V>) => boolean;
|
| 1043 |
/**
|
| 1044 |
+
* Checks whether all values in the HashSet satisfy the predicate.
|
| 1045 |
+
*
|
| 1046 |
+
* **Example** (Testing whether every value matches)
|
| 1047 |
*
|
|
|
|
| 1048 |
* ```ts
|
| 1049 |
+
* import { HashSet } from "effect"
|
| 1050 |
*
|
| 1051 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 1052 |
*
|
|
|
|
| 1057 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 1058 |
* ```
|
| 1059 |
*
|
|
|
|
| 1060 |
* @category elements
|
| 1061 |
+
* @since 2.0.0
|
| 1062 |
*/
|
| 1063 |
<V>(self: HashSet<V>, predicate: Predicate<V>): boolean;
|
| 1064 |
};
|
| 1065 |
/**
|
| 1066 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1067 |
*
|
| 1068 |
+
* **Example** (Reducing HashSet values)
|
| 1069 |
+
*
|
| 1070 |
* ```ts
|
| 1071 |
+
* import { HashSet } from "effect"
|
| 1072 |
*
|
| 1073 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1074 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
|
|
| 1080 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1081 |
* ```
|
| 1082 |
*
|
|
|
|
| 1083 |
* @category folding
|
| 1084 |
+
* @since 2.0.0
|
| 1085 |
*/
|
| 1086 |
export declare const reduce: {
|
| 1087 |
/**
|
| 1088 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1089 |
*
|
| 1090 |
+
* **Example** (Reducing HashSet values)
|
| 1091 |
+
*
|
| 1092 |
* ```ts
|
| 1093 |
+
* import { HashSet } from "effect"
|
| 1094 |
*
|
| 1095 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1096 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
|
|
| 1102 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1103 |
* ```
|
| 1104 |
*
|
|
|
|
| 1105 |
* @category folding
|
| 1106 |
+
* @since 2.0.0
|
| 1107 |
*/
|
| 1108 |
<V, U>(zero: U, f: (accumulator: U, value: V) => U): (self: HashSet<V>) => U;
|
| 1109 |
/**
|
| 1110 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 1111 |
*
|
| 1112 |
+
* **Example** (Reducing HashSet values)
|
| 1113 |
+
*
|
| 1114 |
* ```ts
|
| 1115 |
+
* import { HashSet } from "effect"
|
| 1116 |
*
|
| 1117 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 1118 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
|
|
| 1124 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 1125 |
* ```
|
| 1126 |
*
|
|
|
|
| 1127 |
* @category folding
|
| 1128 |
+
* @since 2.0.0
|
| 1129 |
*/
|
| 1130 |
<V, U>(self: HashSet<V>, zero: U, f: (accumulator: U, value: V) => U): U;
|
| 1131 |
};
|
.opencode/node_modules/effect/dist/HashSet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashSet.d.ts","sourceRoot":"","sources":["../src/HashSet.ts"],"names":[],"mappings":"AAAA;;
|
|
|
|
| 1 |
+
{"version":3,"file":"HashSet.d.ts","sourceRoot":"","sources":["../src/HashSet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAA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CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;CAIrD,CAAA"}
|
.opencode/node_modules/effect/dist/HashSet.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 2.0.0
|
| 3 |
*/
|
| 4 |
import * as Dual from "./Function.js";
|
|
@@ -7,9 +15,10 @@ const TypeId = internal.HashSetTypeId;
|
|
| 7 |
/**
|
| 8 |
* Creates an empty HashSet.
|
| 9 |
*
|
| 10 |
-
*
|
|
|
|
| 11 |
* ```ts
|
| 12 |
-
* import
|
| 13 |
*
|
| 14 |
* const set = HashSet.empty<string>()
|
| 15 |
*
|
|
@@ -21,16 +30,17 @@ const TypeId = internal.HashSetTypeId;
|
|
| 21 |
* console.log(HashSet.size(withValues)) // 2
|
| 22 |
* ```
|
| 23 |
*
|
| 24 |
-
* @since 2.0.0
|
| 25 |
* @category constructors
|
|
|
|
| 26 |
*/
|
| 27 |
export const empty = internal.empty;
|
| 28 |
/**
|
| 29 |
* Creates a HashSet from a variable number of values.
|
| 30 |
*
|
| 31 |
-
*
|
|
|
|
| 32 |
* ```ts
|
| 33 |
-
* import
|
| 34 |
*
|
| 35 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
| 36 |
* console.log(HashSet.size(fruits)) // 3
|
|
@@ -42,16 +52,17 @@ export const empty = internal.empty;
|
|
| 42 |
* console.log(HashSet.size(mixed)) // 3
|
| 43 |
* ```
|
| 44 |
*
|
| 45 |
-
* @since 2.0.0
|
| 46 |
* @category constructors
|
|
|
|
| 47 |
*/
|
| 48 |
export const make = internal.make;
|
| 49 |
/**
|
| 50 |
* Creates a HashSet from an iterable collection of values.
|
| 51 |
*
|
| 52 |
-
*
|
|
|
|
| 53 |
* ```ts
|
| 54 |
-
* import
|
| 55 |
*
|
| 56 |
* const fromArray = HashSet.fromIterable(["a", "b", "c", "b", "a"])
|
| 57 |
* console.log(HashSet.size(fromArray)) // 3
|
|
@@ -63,16 +74,17 @@ export const make = internal.make;
|
|
| 63 |
* console.log(Array.from(fromString)) // ["h", "e", "l", "o"]
|
| 64 |
* ```
|
| 65 |
*
|
| 66 |
-
* @since 2.0.0
|
| 67 |
* @category constructors
|
|
|
|
| 68 |
*/
|
| 69 |
export const fromIterable = internal.fromIterable;
|
| 70 |
/**
|
| 71 |
-
* Checks
|
|
|
|
|
|
|
| 72 |
*
|
| 73 |
-
* @example
|
| 74 |
* ```ts
|
| 75 |
-
* import
|
| 76 |
*
|
| 77 |
* const set = HashSet.make(1, 2, 3)
|
| 78 |
* const array = [1, 2, 3]
|
|
@@ -82,16 +94,17 @@ export const fromIterable = internal.fromIterable;
|
|
| 82 |
* console.log(HashSet.isHashSet(null)) // false
|
| 83 |
* ```
|
| 84 |
*
|
| 85 |
-
* @since 2.0.0
|
| 86 |
* @category guards
|
|
|
|
| 87 |
*/
|
| 88 |
export const isHashSet = internal.isHashSet;
|
| 89 |
/**
|
| 90 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 91 |
*
|
| 92 |
-
*
|
|
|
|
| 93 |
* ```ts
|
| 94 |
-
* import
|
| 95 |
*
|
| 96 |
* const set = HashSet.make("a", "b")
|
| 97 |
* const withC = HashSet.add(set, "c")
|
|
@@ -105,24 +118,24 @@ export const isHashSet = internal.isHashSet;
|
|
| 105 |
* console.log(HashSet.size(same)) // 2
|
| 106 |
* ```
|
| 107 |
*
|
| 108 |
-
* @since 2.0.0
|
| 109 |
* @category mutations
|
|
|
|
| 110 |
*/
|
| 111 |
export const add = /*#__PURE__*/Dual.dual(2, internal.add);
|
| 112 |
/**
|
| 113 |
-
* Checks
|
|
|
|
|
|
|
| 114 |
*
|
| 115 |
-
* @example
|
| 116 |
* ```ts
|
| 117 |
-
* import
|
| 118 |
*
|
| 119 |
* // Works with any type that implements Equal
|
| 120 |
-
* import { Equal, Hash } from "effect"
|
| 121 |
*
|
| 122 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 123 |
*
|
| 124 |
* console.log(HashSet.has(set, "apple")) // true
|
| 125 |
-
* console.log(HashSet.has(set, "grape"))
|
| 126 |
*
|
| 127 |
* class Person implements Equal.Equal {
|
| 128 |
* constructor(readonly name: string) {}
|
|
@@ -140,16 +153,17 @@ export const add = /*#__PURE__*/Dual.dual(2, internal.add);
|
|
| 140 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 141 |
* ```
|
| 142 |
*
|
| 143 |
-
* @since 2.0.0
|
| 144 |
* @category elements
|
|
|
|
| 145 |
*/
|
| 146 |
export const has = /*#__PURE__*/Dual.dual(2, internal.has);
|
| 147 |
/**
|
| 148 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 149 |
*
|
| 150 |
-
*
|
|
|
|
| 151 |
* ```ts
|
| 152 |
-
* import
|
| 153 |
*
|
| 154 |
* const set = HashSet.make("a", "b", "c")
|
| 155 |
* const withoutB = HashSet.remove(set, "b")
|
|
@@ -163,16 +177,17 @@ export const has = /*#__PURE__*/Dual.dual(2, internal.has);
|
|
| 163 |
* console.log(HashSet.size(same)) // 3
|
| 164 |
* ```
|
| 165 |
*
|
| 166 |
-
* @since 2.0.0
|
| 167 |
* @category mutations
|
|
|
|
| 168 |
*/
|
| 169 |
export const remove = /*#__PURE__*/Dual.dual(2, internal.remove);
|
| 170 |
/**
|
| 171 |
* Returns the number of values in the HashSet.
|
| 172 |
*
|
| 173 |
-
*
|
|
|
|
| 174 |
* ```ts
|
| 175 |
-
* import
|
| 176 |
*
|
| 177 |
* const empty = HashSet.empty<string>()
|
| 178 |
* console.log(HashSet.size(empty)) // 0
|
|
@@ -184,16 +199,17 @@ export const remove = /*#__PURE__*/Dual.dual(2, internal.remove);
|
|
| 184 |
* console.log(HashSet.size(withDuplicates)) // 3
|
| 185 |
* ```
|
| 186 |
*
|
| 187 |
-
* @since 2.0.0
|
| 188 |
* @category getters
|
|
|
|
| 189 |
*/
|
| 190 |
export const size = internal.size;
|
| 191 |
/**
|
| 192 |
-
* Checks
|
|
|
|
|
|
|
| 193 |
*
|
| 194 |
-
* @example
|
| 195 |
* ```ts
|
| 196 |
-
* import
|
| 197 |
*
|
| 198 |
* const empty = HashSet.empty<string>()
|
| 199 |
* console.log(HashSet.isEmpty(empty)) // true
|
|
@@ -202,16 +218,17 @@ export const size = internal.size;
|
|
| 202 |
* console.log(HashSet.isEmpty(nonEmpty)) // false
|
| 203 |
* ```
|
| 204 |
*
|
| 205 |
-
* @since 2.0.0
|
| 206 |
* @category getters
|
|
|
|
| 207 |
*/
|
| 208 |
export const isEmpty = internal.isEmpty;
|
| 209 |
/**
|
| 210 |
* Creates the union of two HashSets.
|
| 211 |
*
|
| 212 |
-
*
|
|
|
|
| 213 |
* ```ts
|
| 214 |
-
* import
|
| 215 |
*
|
| 216 |
* const set1 = HashSet.make("a", "b")
|
| 217 |
* const set2 = HashSet.make("b", "c")
|
|
@@ -221,16 +238,17 @@ export const isEmpty = internal.isEmpty;
|
|
| 221 |
* console.log(HashSet.size(combined)) // 3
|
| 222 |
* ```
|
| 223 |
*
|
| 224 |
-
* @since 2.0.0
|
| 225 |
* @category combinators
|
|
|
|
| 226 |
*/
|
| 227 |
export const union = /*#__PURE__*/Dual.dual(2, internal.union);
|
| 228 |
/**
|
| 229 |
* Creates the intersection of two HashSets.
|
| 230 |
*
|
| 231 |
-
*
|
|
|
|
| 232 |
* ```ts
|
| 233 |
-
* import
|
| 234 |
*
|
| 235 |
* const set1 = HashSet.make("a", "b", "c")
|
| 236 |
* const set2 = HashSet.make("b", "c", "d")
|
|
@@ -240,16 +258,17 @@ export const union = /*#__PURE__*/Dual.dual(2, internal.union);
|
|
| 240 |
* console.log(HashSet.size(common)) // 2
|
| 241 |
* ```
|
| 242 |
*
|
| 243 |
-
* @since 2.0.0
|
| 244 |
* @category combinators
|
|
|
|
| 245 |
*/
|
| 246 |
export const intersection = /*#__PURE__*/Dual.dual(2, internal.intersection);
|
| 247 |
/**
|
| 248 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 249 |
*
|
| 250 |
-
*
|
|
|
|
| 251 |
* ```ts
|
| 252 |
-
* import
|
| 253 |
*
|
| 254 |
* const set1 = HashSet.make("a", "b", "c")
|
| 255 |
* const set2 = HashSet.make("b", "d")
|
|
@@ -259,16 +278,17 @@ export const intersection = /*#__PURE__*/Dual.dual(2, internal.intersection);
|
|
| 259 |
* console.log(HashSet.size(diff)) // 2
|
| 260 |
* ```
|
| 261 |
*
|
| 262 |
-
* @since 2.0.0
|
| 263 |
* @category combinators
|
|
|
|
| 264 |
*/
|
| 265 |
export const difference = /*#__PURE__*/Dual.dual(2, internal.difference);
|
| 266 |
/**
|
| 267 |
-
* Checks
|
|
|
|
|
|
|
| 268 |
*
|
| 269 |
-
* @example
|
| 270 |
* ```ts
|
| 271 |
-
* import
|
| 272 |
*
|
| 273 |
* const small = HashSet.make("a", "b")
|
| 274 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
@@ -280,16 +300,17 @@ export const difference = /*#__PURE__*/Dual.dual(2, internal.difference);
|
|
| 280 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 281 |
* ```
|
| 282 |
*
|
| 283 |
-
* @since 2.0.0
|
| 284 |
* @category elements
|
|
|
|
| 285 |
*/
|
| 286 |
export const isSubset = /*#__PURE__*/Dual.dual(2, internal.isSubset);
|
| 287 |
/**
|
| 288 |
* Maps each value in the HashSet using the provided function.
|
| 289 |
*
|
| 290 |
-
*
|
|
|
|
| 291 |
* ```ts
|
| 292 |
-
* import
|
| 293 |
*
|
| 294 |
* const numbers = HashSet.make(1, 2, 3)
|
| 295 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
@@ -303,16 +324,17 @@ export const isSubset = /*#__PURE__*/Dual.dual(2, internal.isSubset);
|
|
| 303 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 304 |
* ```
|
| 305 |
*
|
| 306 |
-
* @since 2.0.0
|
| 307 |
* @category mapping
|
|
|
|
| 308 |
*/
|
| 309 |
export const map = /*#__PURE__*/Dual.dual(2, internal.map);
|
| 310 |
/**
|
| 311 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 312 |
*
|
| 313 |
-
*
|
|
|
|
| 314 |
* ```ts
|
| 315 |
-
* import
|
| 316 |
*
|
| 317 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 318 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
@@ -321,16 +343,17 @@ export const map = /*#__PURE__*/Dual.dual(2, internal.map);
|
|
| 321 |
* console.log(HashSet.size(evens)) // 3
|
| 322 |
* ```
|
| 323 |
*
|
| 324 |
-
* @since 2.0.0
|
| 325 |
* @category filtering
|
|
|
|
| 326 |
*/
|
| 327 |
export const filter = /*#__PURE__*/Dual.dual(2, internal.filter);
|
| 328 |
/**
|
| 329 |
-
*
|
|
|
|
|
|
|
| 330 |
*
|
| 331 |
-
* @example
|
| 332 |
* ```ts
|
| 333 |
-
* import
|
| 334 |
*
|
| 335 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 336 |
*
|
|
@@ -341,16 +364,17 @@ export const filter = /*#__PURE__*/Dual.dual(2, internal.filter);
|
|
| 341 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 342 |
* ```
|
| 343 |
*
|
| 344 |
-
* @since 2.0.0
|
| 345 |
* @category elements
|
|
|
|
| 346 |
*/
|
| 347 |
export const some = /*#__PURE__*/Dual.dual(2, internal.some);
|
| 348 |
/**
|
| 349 |
-
*
|
|
|
|
|
|
|
| 350 |
*
|
| 351 |
-
* @example
|
| 352 |
* ```ts
|
| 353 |
-
* import
|
| 354 |
*
|
| 355 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 356 |
*
|
|
@@ -361,16 +385,17 @@ export const some = /*#__PURE__*/Dual.dual(2, internal.some);
|
|
| 361 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 362 |
* ```
|
| 363 |
*
|
| 364 |
-
* @since 2.0.0
|
| 365 |
* @category elements
|
|
|
|
| 366 |
*/
|
| 367 |
export const every = /*#__PURE__*/Dual.dual(2, internal.every);
|
| 368 |
/**
|
| 369 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 370 |
*
|
| 371 |
-
*
|
|
|
|
| 372 |
* ```ts
|
| 373 |
-
* import
|
| 374 |
*
|
| 375 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 376 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
@@ -382,8 +407,8 @@ export const every = /*#__PURE__*/Dual.dual(2, internal.every);
|
|
| 382 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 383 |
* ```
|
| 384 |
*
|
| 385 |
-
* @since 2.0.0
|
| 386 |
* @category folding
|
|
|
|
| 387 |
*/
|
| 388 |
export const reduce = /*#__PURE__*/Dual.dual(3, internal.reduce);
|
| 389 |
//# sourceMappingURL=HashSet.js.map
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Stores unique values in an immutable hash set.
|
| 3 |
+
*
|
| 4 |
+
* A `HashSet<A>` contains at most one value for each equality class according
|
| 5 |
+
* to Effect's `Equal` and `Hash` rules. Membership checks, additions, removals,
|
| 6 |
+
* and set operations return new sets. This module also includes constructors,
|
| 7 |
+
* union, intersection, difference, subset checks, mapping, filtering, and
|
| 8 |
+
* reducing helpers.
|
| 9 |
+
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
| 12 |
import * as Dual from "./Function.js";
|
|
|
|
| 15 |
/**
|
| 16 |
* Creates an empty HashSet.
|
| 17 |
*
|
| 18 |
+
* **Example** (Creating an empty HashSet)
|
| 19 |
+
*
|
| 20 |
* ```ts
|
| 21 |
+
* import { HashSet } from "effect"
|
| 22 |
*
|
| 23 |
* const set = HashSet.empty<string>()
|
| 24 |
*
|
|
|
|
| 30 |
* console.log(HashSet.size(withValues)) // 2
|
| 31 |
* ```
|
| 32 |
*
|
|
|
|
| 33 |
* @category constructors
|
| 34 |
+
* @since 2.0.0
|
| 35 |
*/
|
| 36 |
export const empty = internal.empty;
|
| 37 |
/**
|
| 38 |
* Creates a HashSet from a variable number of values.
|
| 39 |
*
|
| 40 |
+
* **Example** (Creating a HashSet from values)
|
| 41 |
+
*
|
| 42 |
* ```ts
|
| 43 |
+
* import { HashSet } from "effect"
|
| 44 |
*
|
| 45 |
* const fruits = HashSet.make("apple", "banana", "cherry")
|
| 46 |
* console.log(HashSet.size(fruits)) // 3
|
|
|
|
| 52 |
* console.log(HashSet.size(mixed)) // 3
|
| 53 |
* ```
|
| 54 |
*
|
|
|
|
| 55 |
* @category constructors
|
| 56 |
+
* @since 2.0.0
|
| 57 |
*/
|
| 58 |
export const make = internal.make;
|
| 59 |
/**
|
| 60 |
* Creates a HashSet from an iterable collection of values.
|
| 61 |
*
|
| 62 |
+
* **Example** (Creating a HashSet from an iterable)
|
| 63 |
+
*
|
| 64 |
* ```ts
|
| 65 |
+
* import { HashSet } from "effect"
|
| 66 |
*
|
| 67 |
* const fromArray = HashSet.fromIterable(["a", "b", "c", "b", "a"])
|
| 68 |
* console.log(HashSet.size(fromArray)) // 3
|
|
|
|
| 74 |
* console.log(Array.from(fromString)) // ["h", "e", "l", "o"]
|
| 75 |
* ```
|
| 76 |
*
|
|
|
|
| 77 |
* @category constructors
|
| 78 |
+
* @since 2.0.0
|
| 79 |
*/
|
| 80 |
export const fromIterable = internal.fromIterable;
|
| 81 |
/**
|
| 82 |
+
* Checks whether a value is a HashSet.
|
| 83 |
+
*
|
| 84 |
+
* **Example** (Checking for a HashSet)
|
| 85 |
*
|
|
|
|
| 86 |
* ```ts
|
| 87 |
+
* import { HashSet } from "effect"
|
| 88 |
*
|
| 89 |
* const set = HashSet.make(1, 2, 3)
|
| 90 |
* const array = [1, 2, 3]
|
|
|
|
| 94 |
* console.log(HashSet.isHashSet(null)) // false
|
| 95 |
* ```
|
| 96 |
*
|
|
|
|
| 97 |
* @category guards
|
| 98 |
+
* @since 2.0.0
|
| 99 |
*/
|
| 100 |
export const isHashSet = internal.isHashSet;
|
| 101 |
/**
|
| 102 |
* Adds a value to the HashSet, returning a new HashSet.
|
| 103 |
*
|
| 104 |
+
* **Example** (Adding values to a HashSet)
|
| 105 |
+
*
|
| 106 |
* ```ts
|
| 107 |
+
* import { HashSet } from "effect"
|
| 108 |
*
|
| 109 |
* const set = HashSet.make("a", "b")
|
| 110 |
* const withC = HashSet.add(set, "c")
|
|
|
|
| 118 |
* console.log(HashSet.size(same)) // 2
|
| 119 |
* ```
|
| 120 |
*
|
|
|
|
| 121 |
* @category mutations
|
| 122 |
+
* @since 2.0.0
|
| 123 |
*/
|
| 124 |
export const add = /*#__PURE__*/Dual.dual(2, internal.add);
|
| 125 |
/**
|
| 126 |
+
* Checks whether the HashSet contains the specified value.
|
| 127 |
+
*
|
| 128 |
+
* **Example** (Checking HashSet membership)
|
| 129 |
*
|
|
|
|
| 130 |
* ```ts
|
| 131 |
+
* import { Equal, Hash, HashSet } from "effect"
|
| 132 |
*
|
| 133 |
* // Works with any type that implements Equal
|
|
|
|
| 134 |
*
|
| 135 |
* const set = HashSet.make("apple", "banana", "cherry")
|
| 136 |
*
|
| 137 |
* console.log(HashSet.has(set, "apple")) // true
|
| 138 |
+
* console.log(HashSet.has(set, "grape")) // false
|
| 139 |
*
|
| 140 |
* class Person implements Equal.Equal {
|
| 141 |
* constructor(readonly name: string) {}
|
|
|
|
| 153 |
* console.log(HashSet.has(people, new Person("Alice"))) // true
|
| 154 |
* ```
|
| 155 |
*
|
|
|
|
| 156 |
* @category elements
|
| 157 |
+
* @since 2.0.0
|
| 158 |
*/
|
| 159 |
export const has = /*#__PURE__*/Dual.dual(2, internal.has);
|
| 160 |
/**
|
| 161 |
* Removes a value from the HashSet, returning a new HashSet.
|
| 162 |
*
|
| 163 |
+
* **Example** (Removing values from a HashSet)
|
| 164 |
+
*
|
| 165 |
* ```ts
|
| 166 |
+
* import { HashSet } from "effect"
|
| 167 |
*
|
| 168 |
* const set = HashSet.make("a", "b", "c")
|
| 169 |
* const withoutB = HashSet.remove(set, "b")
|
|
|
|
| 177 |
* console.log(HashSet.size(same)) // 3
|
| 178 |
* ```
|
| 179 |
*
|
|
|
|
| 180 |
* @category mutations
|
| 181 |
+
* @since 2.0.0
|
| 182 |
*/
|
| 183 |
export const remove = /*#__PURE__*/Dual.dual(2, internal.remove);
|
| 184 |
/**
|
| 185 |
* Returns the number of values in the HashSet.
|
| 186 |
*
|
| 187 |
+
* **Example** (Getting the HashSet size)
|
| 188 |
+
*
|
| 189 |
* ```ts
|
| 190 |
+
* import { HashSet } from "effect"
|
| 191 |
*
|
| 192 |
* const empty = HashSet.empty<string>()
|
| 193 |
* console.log(HashSet.size(empty)) // 0
|
|
|
|
| 199 |
* console.log(HashSet.size(withDuplicates)) // 3
|
| 200 |
* ```
|
| 201 |
*
|
|
|
|
| 202 |
* @category getters
|
| 203 |
+
* @since 2.0.0
|
| 204 |
*/
|
| 205 |
export const size = internal.size;
|
| 206 |
/**
|
| 207 |
+
* Checks whether the HashSet is empty.
|
| 208 |
+
*
|
| 209 |
+
* **Example** (Checking whether a HashSet is empty)
|
| 210 |
*
|
|
|
|
| 211 |
* ```ts
|
| 212 |
+
* import { HashSet } from "effect"
|
| 213 |
*
|
| 214 |
* const empty = HashSet.empty<string>()
|
| 215 |
* console.log(HashSet.isEmpty(empty)) // true
|
|
|
|
| 218 |
* console.log(HashSet.isEmpty(nonEmpty)) // false
|
| 219 |
* ```
|
| 220 |
*
|
|
|
|
| 221 |
* @category getters
|
| 222 |
+
* @since 4.0.0
|
| 223 |
*/
|
| 224 |
export const isEmpty = internal.isEmpty;
|
| 225 |
/**
|
| 226 |
* Creates the union of two HashSets.
|
| 227 |
*
|
| 228 |
+
* **Example** (Combining HashSets)
|
| 229 |
+
*
|
| 230 |
* ```ts
|
| 231 |
+
* import { HashSet } from "effect"
|
| 232 |
*
|
| 233 |
* const set1 = HashSet.make("a", "b")
|
| 234 |
* const set2 = HashSet.make("b", "c")
|
|
|
|
| 238 |
* console.log(HashSet.size(combined)) // 3
|
| 239 |
* ```
|
| 240 |
*
|
|
|
|
| 241 |
* @category combinators
|
| 242 |
+
* @since 2.0.0
|
| 243 |
*/
|
| 244 |
export const union = /*#__PURE__*/Dual.dual(2, internal.union);
|
| 245 |
/**
|
| 246 |
* Creates the intersection of two HashSets.
|
| 247 |
*
|
| 248 |
+
* **Example** (Finding common HashSet values)
|
| 249 |
+
*
|
| 250 |
* ```ts
|
| 251 |
+
* import { HashSet } from "effect"
|
| 252 |
*
|
| 253 |
* const set1 = HashSet.make("a", "b", "c")
|
| 254 |
* const set2 = HashSet.make("b", "c", "d")
|
|
|
|
| 258 |
* console.log(HashSet.size(common)) // 2
|
| 259 |
* ```
|
| 260 |
*
|
|
|
|
| 261 |
* @category combinators
|
| 262 |
+
* @since 2.0.0
|
| 263 |
*/
|
| 264 |
export const intersection = /*#__PURE__*/Dual.dual(2, internal.intersection);
|
| 265 |
/**
|
| 266 |
* Creates the difference of two HashSets (elements in the first set that are not in the second).
|
| 267 |
*
|
| 268 |
+
* **Example** (Finding HashSet differences)
|
| 269 |
+
*
|
| 270 |
* ```ts
|
| 271 |
+
* import { HashSet } from "effect"
|
| 272 |
*
|
| 273 |
* const set1 = HashSet.make("a", "b", "c")
|
| 274 |
* const set2 = HashSet.make("b", "d")
|
|
|
|
| 278 |
* console.log(HashSet.size(diff)) // 2
|
| 279 |
* ```
|
| 280 |
*
|
|
|
|
| 281 |
* @category combinators
|
| 282 |
+
* @since 2.0.0
|
| 283 |
*/
|
| 284 |
export const difference = /*#__PURE__*/Dual.dual(2, internal.difference);
|
| 285 |
/**
|
| 286 |
+
* Checks whether a HashSet is a subset of another HashSet.
|
| 287 |
+
*
|
| 288 |
+
* **Example** (Checking subset relationships)
|
| 289 |
*
|
|
|
|
| 290 |
* ```ts
|
| 291 |
+
* import { HashSet } from "effect"
|
| 292 |
*
|
| 293 |
* const small = HashSet.make("a", "b")
|
| 294 |
* const large = HashSet.make("a", "b", "c", "d")
|
|
|
|
| 300 |
* console.log(HashSet.isSubset(small, small)) // true
|
| 301 |
* ```
|
| 302 |
*
|
|
|
|
| 303 |
* @category elements
|
| 304 |
+
* @since 2.0.0
|
| 305 |
*/
|
| 306 |
export const isSubset = /*#__PURE__*/Dual.dual(2, internal.isSubset);
|
| 307 |
/**
|
| 308 |
* Maps each value in the HashSet using the provided function.
|
| 309 |
*
|
| 310 |
+
* **Example** (Mapping HashSet values)
|
| 311 |
+
*
|
| 312 |
* ```ts
|
| 313 |
+
* import { HashSet } from "effect"
|
| 314 |
*
|
| 315 |
* const numbers = HashSet.make(1, 2, 3)
|
| 316 |
* const doubled = HashSet.map(numbers, (n) => n * 2)
|
|
|
|
| 324 |
* console.log(Array.from(lengths).sort()) // [5, 6] (apple=5, banana=6, cherry=6)
|
| 325 |
* ```
|
| 326 |
*
|
|
|
|
| 327 |
* @category mapping
|
| 328 |
+
* @since 2.0.0
|
| 329 |
*/
|
| 330 |
export const map = /*#__PURE__*/Dual.dual(2, internal.map);
|
| 331 |
/**
|
| 332 |
* Filters the HashSet keeping only values that satisfy the predicate.
|
| 333 |
*
|
| 334 |
+
* **Example** (Filtering HashSet values)
|
| 335 |
+
*
|
| 336 |
* ```ts
|
| 337 |
+
* import { HashSet } from "effect"
|
| 338 |
*
|
| 339 |
* const numbers = HashSet.make(1, 2, 3, 4, 5, 6)
|
| 340 |
* const evens = HashSet.filter(numbers, (n) => n % 2 === 0)
|
|
|
|
| 343 |
* console.log(HashSet.size(evens)) // 3
|
| 344 |
* ```
|
| 345 |
*
|
|
|
|
| 346 |
* @category filtering
|
| 347 |
+
* @since 2.0.0
|
| 348 |
*/
|
| 349 |
export const filter = /*#__PURE__*/Dual.dual(2, internal.filter);
|
| 350 |
/**
|
| 351 |
+
* Checks whether at least one value in the HashSet satisfies the predicate.
|
| 352 |
+
*
|
| 353 |
+
* **Example** (Testing whether some values match)
|
| 354 |
*
|
|
|
|
| 355 |
* ```ts
|
| 356 |
+
* import { HashSet } from "effect"
|
| 357 |
*
|
| 358 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 359 |
*
|
|
|
|
| 364 |
* console.log(HashSet.some(empty, (n) => n > 0)) // false
|
| 365 |
* ```
|
| 366 |
*
|
|
|
|
| 367 |
* @category elements
|
| 368 |
+
* @since 2.0.0
|
| 369 |
*/
|
| 370 |
export const some = /*#__PURE__*/Dual.dual(2, internal.some);
|
| 371 |
/**
|
| 372 |
+
* Checks whether all values in the HashSet satisfy the predicate.
|
| 373 |
+
*
|
| 374 |
+
* **Example** (Testing whether every value matches)
|
| 375 |
*
|
|
|
|
| 376 |
* ```ts
|
| 377 |
+
* import { HashSet } from "effect"
|
| 378 |
*
|
| 379 |
* const numbers = HashSet.make(2, 4, 6, 8)
|
| 380 |
*
|
|
|
|
| 385 |
* console.log(HashSet.every(empty, (n) => n > 0)) // true (vacuously true)
|
| 386 |
* ```
|
| 387 |
*
|
|
|
|
| 388 |
* @category elements
|
| 389 |
+
* @since 2.0.0
|
| 390 |
*/
|
| 391 |
export const every = /*#__PURE__*/Dual.dual(2, internal.every);
|
| 392 |
/**
|
| 393 |
* Reduces the HashSet to a single value by iterating through the values and applying an accumulator function.
|
| 394 |
*
|
| 395 |
+
* **Example** (Reducing HashSet values)
|
| 396 |
+
*
|
| 397 |
* ```ts
|
| 398 |
+
* import { HashSet } from "effect"
|
| 399 |
*
|
| 400 |
* const numbers = HashSet.make(1, 2, 3, 4, 5)
|
| 401 |
* const sum = HashSet.reduce(numbers, 0, (acc, n) => acc + n)
|
|
|
|
| 407 |
* console.log(concatenated) // Order may vary: "abc", "bac", etc.
|
| 408 |
* ```
|
| 409 |
*
|
|
|
|
| 410 |
* @category folding
|
| 411 |
+
* @since 2.0.0
|
| 412 |
*/
|
| 413 |
export const reduce = /*#__PURE__*/Dual.dual(3, internal.reduce);
|
| 414 |
//# sourceMappingURL=HashSet.js.map
|
.opencode/node_modules/effect/dist/HashSet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"HashSet.js","names":["Dual","internal","TypeId","HashSetTypeId","empty","make","fromIterable","isHashSet","add","dual","has","remove","size","isEmpty","union","intersection","difference","isSubset","map","filter","some","every","reduce"],"sources":["../src/HashSet.ts"],"sourcesContent":[null],"mappings":"AAAA;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"HashSet.js","names":["Dual","internal","TypeId","HashSetTypeId","empty","make","fromIterable","isHashSet","add","dual","has","remove","size","isEmpty","union","intersection","difference","isSubset","map","filter","some","every","reduce"],"sources":["../src/HashSet.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAaA,OAAO,KAAKA,IAAI,MAAM,eAAe;AAErC,OAAO,KAAKC,QAAQ,MAAM,uBAAuB;AAKjD,MAAMC,MAAM,GAAGD,QAAQ,CAACE,aAAa;AAoFrC;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,KAAK,GAAgCH,QAAQ,CAACG,KAAK;AAEhE;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,IAAI,GAEcJ,QAAQ,CAACI,IAAI;AAE5C;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,YAAY,GAA2CL,QAAQ,CAACK,YAAY;AAEzF;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,MAAMC,SAAS,GAyClBN,QAAQ,CAACM,SAAS;AAEtB;;;;;;;;;;;;;;;;;;;;;;;AAuBA,OAAO,MAAMC,GAAG,gBAiDZR,IAAI,CAACS,IAAI,CAGX,CAAC,EAAER,QAAQ,CAACO,GAAG,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,OAAO,MAAME,GAAG,gBAuEZV,IAAI,CAACS,IAAI,CAGX,CAAC,EAAER,QAAQ,CAACS,GAAG,CAAC;AAElB;;;;;;;;;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MC,KAAK,gBA2CdrB,IAAI,CAACS,IAAI,CAGX,CAAC,EAAER,QAAQ,CAACoB,KAAK,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,MAAM,gBA6CftB,IAAI,CAACS,IAAI,CAGX,CAAC,EAAER,QAAQ,CAACqB,MAAM,CAAC","ignoreList":[]}
|
.opencode/node_modules/effect/dist/Inspectable.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
*
|
| 4 |
* This symbol is recognized by Node.js's `util.inspect()` function and the REPL
|
| 5 |
* for custom object representation. When an object has a method with this symbol,
|
| 6 |
* it will be called to determine how the object should be displayed.
|
| 7 |
*
|
| 8 |
-
*
|
|
|
|
| 9 |
* ```ts
|
| 10 |
* import { Inspectable } from "effect"
|
| 11 |
*
|
|
@@ -21,8 +28,8 @@
|
|
| 21 |
* console.log(obj) // Displays: CustomObject(hello)
|
| 22 |
* ```
|
| 23 |
*
|
| 24 |
-
* @since 2.0.0
|
| 25 |
* @category symbols
|
|
|
|
| 26 |
*/
|
| 27 |
export declare const NodeInspectSymbol: unique symbol;
|
| 28 |
/**
|
|
@@ -30,7 +37,12 @@ export declare const NodeInspectSymbol: unique symbol;
|
|
| 30 |
* This symbol type is used to implement custom inspection behavior in Node.js
|
| 31 |
* environments.
|
| 32 |
*
|
| 33 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
* ```ts
|
| 35 |
* import { Inspectable } from "effect"
|
| 36 |
*
|
|
@@ -46,21 +58,27 @@ export declare const NodeInspectSymbol: unique symbol;
|
|
| 46 |
* console.log(obj) // CustomObject(test)
|
| 47 |
* ```
|
| 48 |
*
|
| 49 |
-
* @since 2.0.0
|
| 50 |
* @category symbols
|
|
|
|
| 51 |
*/
|
| 52 |
export type NodeInspectSymbol = typeof NodeInspectSymbol;
|
| 53 |
/**
|
| 54 |
* Interface for objects that can be inspected and provide custom string representations.
|
| 55 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
* Objects implementing this interface can control how they appear in debugging contexts,
|
| 57 |
* JSON serialization, and Node.js inspection. This is particularly useful for creating
|
| 58 |
* custom data types that display meaningful information during development.
|
| 59 |
*
|
| 60 |
-
*
|
|
|
|
| 61 |
* ```ts
|
| 62 |
-
* import { Inspectable } from "effect"
|
| 63 |
-
* import { format } from "effect/Formatter"
|
| 64 |
*
|
| 65 |
* class Result implements Inspectable.Inspectable {
|
| 66 |
* constructor(
|
|
@@ -69,7 +87,7 @@ export type NodeInspectSymbol = typeof NodeInspectSymbol;
|
|
| 69 |
* ) {}
|
| 70 |
*
|
| 71 |
* toString(): string {
|
| 72 |
-
* return format(this.toJSON())
|
| 73 |
* }
|
| 74 |
*
|
| 75 |
* toJSON() {
|
|
@@ -85,8 +103,8 @@ export type NodeInspectSymbol = typeof NodeInspectSymbol;
|
|
| 85 |
* console.log(success.toString()) // Pretty formatted JSON
|
| 86 |
* ```
|
| 87 |
*
|
| 88 |
-
* @since 2.0.0
|
| 89 |
* @category models
|
|
|
|
| 90 |
*/
|
| 91 |
export interface Inspectable {
|
| 92 |
toString(): string;
|
|
@@ -94,29 +112,58 @@ export interface Inspectable {
|
|
| 94 |
[NodeInspectSymbol](): unknown;
|
| 95 |
}
|
| 96 |
/**
|
| 97 |
-
*
|
| 98 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
*
|
| 100 |
* This function attempts to extract JSON data from objects that implement the
|
| 101 |
* `toJSON` method, recursively processes arrays, and handles errors gracefully.
|
| 102 |
* For objects that don't have a `toJSON` method, it applies redaction to
|
| 103 |
* protect sensitive information.
|
| 104 |
*
|
| 105 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 106 |
*/
|
| 107 |
export declare const toJson: (input: unknown) => unknown;
|
| 108 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
* @since 2.0.0
|
| 110 |
*/
|
| 111 |
export declare const toStringUnknown: (u: unknown, whitespace?: number | string | undefined) => string;
|
| 112 |
/**
|
| 113 |
* A base prototype object that implements the {@link Inspectable} interface.
|
| 114 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
* This object provides default implementations for the {@link Inspectable} methods.
|
| 116 |
* It can be used as a prototype for objects that want to be inspectable,
|
| 117 |
* or as a mixin to add inspection capabilities to existing objects.
|
| 118 |
*
|
| 119 |
-
*
|
|
|
|
| 120 |
* ```ts
|
| 121 |
* import { Inspectable } from "effect"
|
| 122 |
*
|
|
@@ -135,17 +182,25 @@ export declare const toStringUnknown: (u: unknown, whitespace?: number | string
|
|
| 135 |
* MyClass.prototype.constructor = MyClass
|
| 136 |
* ```
|
| 137 |
*
|
|
|
|
| 138 |
* @since 2.0.0
|
| 139 |
*/
|
| 140 |
export declare const BaseProto: Inspectable;
|
| 141 |
/**
|
| 142 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
*
|
| 144 |
* This class provides a convenient way to create inspectable objects by extending it.
|
| 145 |
* Subclasses only need to implement the `toJSON()` method, and they automatically
|
| 146 |
* get proper `toString()` and Node.js inspection support.
|
| 147 |
*
|
| 148 |
-
*
|
|
|
|
| 149 |
* ```ts
|
| 150 |
* import { Inspectable } from "effect"
|
| 151 |
*
|
|
@@ -173,13 +228,19 @@ export declare const BaseProto: Inspectable;
|
|
| 173 |
* console.log(user) // In Node.js, shows the same formatted output
|
| 174 |
* ```
|
| 175 |
*
|
| 176 |
-
* @since 2.0.0
|
| 177 |
* @category classes
|
|
|
|
| 178 |
*/
|
| 179 |
export declare abstract class Class {
|
| 180 |
/**
|
| 181 |
* Returns a JSON representation of this object.
|
| 182 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
* Subclasses must implement this method to define how the object
|
| 184 |
* should be serialized for debugging and inspection purposes.
|
| 185 |
*
|
|
@@ -189,12 +250,20 @@ export declare abstract class Class {
|
|
| 189 |
/**
|
| 190 |
* Node.js custom inspection method.
|
| 191 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
* @since 2.0.0
|
| 193 |
*/
|
| 194 |
[NodeInspectSymbol](): unknown;
|
| 195 |
/**
|
| 196 |
* Returns a formatted string representation of this object.
|
| 197 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
* @since 2.0.0
|
| 199 |
*/
|
| 200 |
toString(): string;
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Defines the symbol used by Node.js for custom object inspection.
|
| 3 |
+
*
|
| 4 |
+
* **When to use**
|
| 5 |
+
*
|
| 6 |
+
* Use to implement Node.js custom inspection for a value.
|
| 7 |
+
*
|
| 8 |
+
* **Details**
|
| 9 |
*
|
| 10 |
* This symbol is recognized by Node.js's `util.inspect()` function and the REPL
|
| 11 |
* for custom object representation. When an object has a method with this symbol,
|
| 12 |
* it will be called to determine how the object should be displayed.
|
| 13 |
*
|
| 14 |
+
* **Example** (Defining custom Node inspection)
|
| 15 |
+
*
|
| 16 |
* ```ts
|
| 17 |
* import { Inspectable } from "effect"
|
| 18 |
*
|
|
|
|
| 28 |
* console.log(obj) // Displays: CustomObject(hello)
|
| 29 |
* ```
|
| 30 |
*
|
|
|
|
| 31 |
* @category symbols
|
| 32 |
+
* @since 2.0.0
|
| 33 |
*/
|
| 34 |
export declare const NodeInspectSymbol: unique symbol;
|
| 35 |
/**
|
|
|
|
| 37 |
* This symbol type is used to implement custom inspection behavior in Node.js
|
| 38 |
* environments.
|
| 39 |
*
|
| 40 |
+
* **When to use**
|
| 41 |
+
*
|
| 42 |
+
* Use to type methods keyed by the Node.js custom inspection symbol.
|
| 43 |
+
*
|
| 44 |
+
* **Example** (Typing custom Node inspection)
|
| 45 |
+
*
|
| 46 |
* ```ts
|
| 47 |
* import { Inspectable } from "effect"
|
| 48 |
*
|
|
|
|
| 58 |
* console.log(obj) // CustomObject(test)
|
| 59 |
* ```
|
| 60 |
*
|
|
|
|
| 61 |
* @category symbols
|
| 62 |
+
* @since 2.0.0
|
| 63 |
*/
|
| 64 |
export type NodeInspectSymbol = typeof NodeInspectSymbol;
|
| 65 |
/**
|
| 66 |
* Interface for objects that can be inspected and provide custom string representations.
|
| 67 |
*
|
| 68 |
+
* **When to use**
|
| 69 |
+
*
|
| 70 |
+
* Use to define values with custom string, JSON, and Node.js inspection output.
|
| 71 |
+
*
|
| 72 |
+
* **Details**
|
| 73 |
+
*
|
| 74 |
* Objects implementing this interface can control how they appear in debugging contexts,
|
| 75 |
* JSON serialization, and Node.js inspection. This is particularly useful for creating
|
| 76 |
* custom data types that display meaningful information during development.
|
| 77 |
*
|
| 78 |
+
* **Example** (Implementing inspectable objects)
|
| 79 |
+
*
|
| 80 |
* ```ts
|
| 81 |
+
* import { Formatter, Inspectable } from "effect"
|
|
|
|
| 82 |
*
|
| 83 |
* class Result implements Inspectable.Inspectable {
|
| 84 |
* constructor(
|
|
|
|
| 87 |
* ) {}
|
| 88 |
*
|
| 89 |
* toString(): string {
|
| 90 |
+
* return Formatter.format(this.toJSON())
|
| 91 |
* }
|
| 92 |
*
|
| 93 |
* toJSON() {
|
|
|
|
| 103 |
* console.log(success.toString()) // Pretty formatted JSON
|
| 104 |
* ```
|
| 105 |
*
|
|
|
|
| 106 |
* @category models
|
| 107 |
+
* @since 2.0.0
|
| 108 |
*/
|
| 109 |
export interface Inspectable {
|
| 110 |
toString(): string;
|
|
|
|
| 112 |
[NodeInspectSymbol](): unknown;
|
| 113 |
}
|
| 114 |
/**
|
| 115 |
+
* Converts a value to a JSON-serializable representation safely.
|
| 116 |
+
*
|
| 117 |
+
* **When to use**
|
| 118 |
+
*
|
| 119 |
+
* Use when you need a safe, JSON-serializable representation of a value
|
| 120 |
+
* without risking unhandled errors.
|
| 121 |
+
*
|
| 122 |
+
* **Details**
|
| 123 |
*
|
| 124 |
* This function attempts to extract JSON data from objects that implement the
|
| 125 |
* `toJSON` method, recursively processes arrays, and handles errors gracefully.
|
| 126 |
* For objects that don't have a `toJSON` method, it applies redaction to
|
| 127 |
* protect sensitive information.
|
| 128 |
*
|
| 129 |
+
* @see {@link toStringUnknown} for converting unknown values to strings
|
| 130 |
+
*
|
| 131 |
+
* @category converting
|
| 132 |
+
* @since 4.0.0
|
| 133 |
*/
|
| 134 |
export declare const toJson: (input: unknown) => unknown;
|
| 135 |
/**
|
| 136 |
+
* Converts an unknown value to a string for diagnostics.
|
| 137 |
+
*
|
| 138 |
+
* **When to use**
|
| 139 |
+
*
|
| 140 |
+
* Use to produce a diagnostic string from a value whose runtime type is unknown.
|
| 141 |
+
*
|
| 142 |
+
* **Details**
|
| 143 |
+
*
|
| 144 |
+
* Strings are returned unchanged. Objects are formatted as JSON using the
|
| 145 |
+
* provided whitespace setting when possible, and values that cannot be
|
| 146 |
+
* formatted are converted with `String`.
|
| 147 |
+
*
|
| 148 |
+
* @category converting
|
| 149 |
* @since 2.0.0
|
| 150 |
*/
|
| 151 |
export declare const toStringUnknown: (u: unknown, whitespace?: number | string | undefined) => string;
|
| 152 |
/**
|
| 153 |
* A base prototype object that implements the {@link Inspectable} interface.
|
| 154 |
*
|
| 155 |
+
* **When to use**
|
| 156 |
+
*
|
| 157 |
+
* Use as a prototype for plain objects that should share standard inspectable behavior.
|
| 158 |
+
*
|
| 159 |
+
* **Details**
|
| 160 |
+
*
|
| 161 |
* This object provides default implementations for the {@link Inspectable} methods.
|
| 162 |
* It can be used as a prototype for objects that want to be inspectable,
|
| 163 |
* or as a mixin to add inspection capabilities to existing objects.
|
| 164 |
*
|
| 165 |
+
* **Example** (Using the base inspectable prototype)
|
| 166 |
+
*
|
| 167 |
* ```ts
|
| 168 |
* import { Inspectable } from "effect"
|
| 169 |
*
|
|
|
|
| 182 |
* MyClass.prototype.constructor = MyClass
|
| 183 |
* ```
|
| 184 |
*
|
| 185 |
+
* @category prototypes
|
| 186 |
* @since 2.0.0
|
| 187 |
*/
|
| 188 |
export declare const BaseProto: Inspectable;
|
| 189 |
/**
|
| 190 |
+
* Provides an abstract base class that implements the Inspectable interface.
|
| 191 |
+
*
|
| 192 |
+
* **When to use**
|
| 193 |
+
*
|
| 194 |
+
* Use as a base class for inspectable objects that define their own JSON representation.
|
| 195 |
+
*
|
| 196 |
+
* **Details**
|
| 197 |
*
|
| 198 |
* This class provides a convenient way to create inspectable objects by extending it.
|
| 199 |
* Subclasses only need to implement the `toJSON()` method, and they automatically
|
| 200 |
* get proper `toString()` and Node.js inspection support.
|
| 201 |
*
|
| 202 |
+
* **Example** (Extending the inspectable base class)
|
| 203 |
+
*
|
| 204 |
* ```ts
|
| 205 |
* import { Inspectable } from "effect"
|
| 206 |
*
|
|
|
|
| 228 |
* console.log(user) // In Node.js, shows the same formatted output
|
| 229 |
* ```
|
| 230 |
*
|
|
|
|
| 231 |
* @category classes
|
| 232 |
+
* @since 2.0.0
|
| 233 |
*/
|
| 234 |
export declare abstract class Class {
|
| 235 |
/**
|
| 236 |
* Returns a JSON representation of this object.
|
| 237 |
*
|
| 238 |
+
* **When to use**
|
| 239 |
+
*
|
| 240 |
+
* Use to provide the JSON representation consumed by inherited inspection methods.
|
| 241 |
+
*
|
| 242 |
+
* **Details**
|
| 243 |
+
*
|
| 244 |
* Subclasses must implement this method to define how the object
|
| 245 |
* should be serialized for debugging and inspection purposes.
|
| 246 |
*
|
|
|
|
| 250 |
/**
|
| 251 |
* Node.js custom inspection method.
|
| 252 |
*
|
| 253 |
+
* **When to use**
|
| 254 |
+
*
|
| 255 |
+
* Use to expose the class JSON representation to Node.js inspection.
|
| 256 |
+
*
|
| 257 |
* @since 2.0.0
|
| 258 |
*/
|
| 259 |
[NodeInspectSymbol](): unknown;
|
| 260 |
/**
|
| 261 |
* Returns a formatted string representation of this object.
|
| 262 |
*
|
| 263 |
+
* **When to use**
|
| 264 |
+
*
|
| 265 |
+
* Use to format the class JSON representation as a string.
|
| 266 |
+
*
|
| 267 |
* @since 2.0.0
|
| 268 |
*/
|
| 269 |
toString(): string;
|
.opencode/node_modules/effect/dist/Inspectable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Inspectable.d.ts","sourceRoot":"","sources":["../src/Inspectable.ts"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"Inspectable.d.ts","sourceRoot":"","sources":["../src/Inspectable.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,iBAAiB,eAA2C,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,IAAI,MAAM,CAAA;IAClB,MAAM,IAAI,OAAO,CAAA;IACjB,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,OAevC,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,OAAO,EAAE,aAAY,MAAM,GAAG,MAAM,GAAG,SAAa,KAAG,MASzF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,SAAS,EAAE,WAUvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,8BAAsB,KAAK;IACzB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,IAAI,OAAO;IAC1B;;;;;;;;OAQG;IACH,CAAC,iBAAiB,CAAC;IAGnB;;;;;;;;OAQG;IACH,QAAQ;CAGT"}
|
.opencode/node_modules/effect/dist/Inspectable.js
CHANGED
|
@@ -1,39 +1,11 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* to provide different representations based on the current execution context.
|
| 10 |
-
*
|
| 11 |
-
* @example
|
| 12 |
-
* ```ts
|
| 13 |
-
* import { Inspectable } from "effect"
|
| 14 |
-
* import { format } from "effect/Formatter"
|
| 15 |
-
*
|
| 16 |
-
* class User extends Inspectable.Class {
|
| 17 |
-
* constructor(
|
| 18 |
-
* public readonly name: string,
|
| 19 |
-
* public readonly email: string
|
| 20 |
-
* ) {
|
| 21 |
-
* super()
|
| 22 |
-
* }
|
| 23 |
-
*
|
| 24 |
-
* toJSON() {
|
| 25 |
-
* return {
|
| 26 |
-
* _tag: "User",
|
| 27 |
-
* name: this.name,
|
| 28 |
-
* email: this.email
|
| 29 |
-
* }
|
| 30 |
-
* }
|
| 31 |
-
* }
|
| 32 |
-
*
|
| 33 |
-
* const user = new User("Alice", "alice@example.com")
|
| 34 |
-
* console.log(user.toString()) // Pretty printed JSON
|
| 35 |
-
* console.log(format(user)) // Same as toString()
|
| 36 |
-
* ```
|
| 37 |
*
|
| 38 |
* @since 2.0.0
|
| 39 |
*/
|
|
@@ -41,13 +13,20 @@ import { format, formatJson } from "./Formatter.js";
|
|
| 41 |
import * as Predicate from "./Predicate.js";
|
| 42 |
import { redact } from "./Redactable.js";
|
| 43 |
/**
|
| 44 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
*
|
| 46 |
* This symbol is recognized by Node.js's `util.inspect()` function and the REPL
|
| 47 |
* for custom object representation. When an object has a method with this symbol,
|
| 48 |
* it will be called to determine how the object should be displayed.
|
| 49 |
*
|
| 50 |
-
*
|
|
|
|
| 51 |
* ```ts
|
| 52 |
* import { Inspectable } from "effect"
|
| 53 |
*
|
|
@@ -63,20 +42,29 @@ import { redact } from "./Redactable.js";
|
|
| 63 |
* console.log(obj) // Displays: CustomObject(hello)
|
| 64 |
* ```
|
| 65 |
*
|
| 66 |
-
* @since 2.0.0
|
| 67 |
* @category symbols
|
|
|
|
| 68 |
*/
|
| 69 |
export const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
|
| 70 |
/**
|
| 71 |
-
*
|
| 72 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
*
|
| 74 |
* This function attempts to extract JSON data from objects that implement the
|
| 75 |
* `toJSON` method, recursively processes arrays, and handles errors gracefully.
|
| 76 |
* For objects that don't have a `toJSON` method, it applies redaction to
|
| 77 |
* protect sensitive information.
|
| 78 |
*
|
| 79 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 80 |
*/
|
| 81 |
export const toJson = input => {
|
| 82 |
try {
|
|
@@ -91,6 +79,19 @@ export const toJson = input => {
|
|
| 91 |
return redact(input);
|
| 92 |
};
|
| 93 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
* @since 2.0.0
|
| 95 |
*/
|
| 96 |
export const toStringUnknown = (u, whitespace = 2) => {
|
|
@@ -108,11 +109,18 @@ export const toStringUnknown = (u, whitespace = 2) => {
|
|
| 108 |
/**
|
| 109 |
* A base prototype object that implements the {@link Inspectable} interface.
|
| 110 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
* This object provides default implementations for the {@link Inspectable} methods.
|
| 112 |
* It can be used as a prototype for objects that want to be inspectable,
|
| 113 |
* or as a mixin to add inspection capabilities to existing objects.
|
| 114 |
*
|
| 115 |
-
*
|
|
|
|
| 116 |
* ```ts
|
| 117 |
* import { Inspectable } from "effect"
|
| 118 |
*
|
|
@@ -131,6 +139,7 @@ export const toStringUnknown = (u, whitespace = 2) => {
|
|
| 131 |
* MyClass.prototype.constructor = MyClass
|
| 132 |
* ```
|
| 133 |
*
|
|
|
|
| 134 |
* @since 2.0.0
|
| 135 |
*/
|
| 136 |
export const BaseProto = {
|
|
@@ -145,13 +154,20 @@ export const BaseProto = {
|
|
| 145 |
}
|
| 146 |
};
|
| 147 |
/**
|
| 148 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
*
|
| 150 |
* This class provides a convenient way to create inspectable objects by extending it.
|
| 151 |
* Subclasses only need to implement the `toJSON()` method, and they automatically
|
| 152 |
* get proper `toString()` and Node.js inspection support.
|
| 153 |
*
|
| 154 |
-
*
|
|
|
|
| 155 |
* ```ts
|
| 156 |
* import { Inspectable } from "effect"
|
| 157 |
*
|
|
@@ -179,13 +195,17 @@ export const BaseProto = {
|
|
| 179 |
* console.log(user) // In Node.js, shows the same formatted output
|
| 180 |
* ```
|
| 181 |
*
|
| 182 |
-
* @since 2.0.0
|
| 183 |
* @category classes
|
|
|
|
| 184 |
*/
|
| 185 |
export class Class {
|
| 186 |
/**
|
| 187 |
* Node.js custom inspection method.
|
| 188 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
* @since 2.0.0
|
| 190 |
*/
|
| 191 |
[NodeInspectSymbol]() {
|
|
@@ -194,6 +214,10 @@ export class Class {
|
|
| 194 |
/**
|
| 195 |
* Returns a formatted string representation of this object.
|
| 196 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
* @since 2.0.0
|
| 198 |
*/
|
| 199 |
toString() {
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Controls how values appear in logs and debugging output.
|
| 3 |
*
|
| 4 |
+
* Effect data types use `Inspectable` to provide stable string, JSON, and
|
| 5 |
+
* Node.js inspection output. This keeps custom values readable in logs, REPLs,
|
| 6 |
+
* test failures, and diagnostics. This module defines the Node inspect symbol,
|
| 7 |
+
* the `Inspectable` interface, safe conversion helpers, and shared prototype or
|
| 8 |
+
* class implementations for custom values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
*
|
| 10 |
* @since 2.0.0
|
| 11 |
*/
|
|
|
|
| 13 |
import * as Predicate from "./Predicate.js";
|
| 14 |
import { redact } from "./Redactable.js";
|
| 15 |
/**
|
| 16 |
+
* Defines the symbol used by Node.js for custom object inspection.
|
| 17 |
+
*
|
| 18 |
+
* **When to use**
|
| 19 |
+
*
|
| 20 |
+
* Use to implement Node.js custom inspection for a value.
|
| 21 |
+
*
|
| 22 |
+
* **Details**
|
| 23 |
*
|
| 24 |
* This symbol is recognized by Node.js's `util.inspect()` function and the REPL
|
| 25 |
* for custom object representation. When an object has a method with this symbol,
|
| 26 |
* it will be called to determine how the object should be displayed.
|
| 27 |
*
|
| 28 |
+
* **Example** (Defining custom Node inspection)
|
| 29 |
+
*
|
| 30 |
* ```ts
|
| 31 |
* import { Inspectable } from "effect"
|
| 32 |
*
|
|
|
|
| 42 |
* console.log(obj) // Displays: CustomObject(hello)
|
| 43 |
* ```
|
| 44 |
*
|
|
|
|
| 45 |
* @category symbols
|
| 46 |
+
* @since 2.0.0
|
| 47 |
*/
|
| 48 |
export const NodeInspectSymbol = /*#__PURE__*/Symbol.for("nodejs.util.inspect.custom");
|
| 49 |
/**
|
| 50 |
+
* Converts a value to a JSON-serializable representation safely.
|
| 51 |
+
*
|
| 52 |
+
* **When to use**
|
| 53 |
+
*
|
| 54 |
+
* Use when you need a safe, JSON-serializable representation of a value
|
| 55 |
+
* without risking unhandled errors.
|
| 56 |
+
*
|
| 57 |
+
* **Details**
|
| 58 |
*
|
| 59 |
* This function attempts to extract JSON data from objects that implement the
|
| 60 |
* `toJSON` method, recursively processes arrays, and handles errors gracefully.
|
| 61 |
* For objects that don't have a `toJSON` method, it applies redaction to
|
| 62 |
* protect sensitive information.
|
| 63 |
*
|
| 64 |
+
* @see {@link toStringUnknown} for converting unknown values to strings
|
| 65 |
+
*
|
| 66 |
+
* @category converting
|
| 67 |
+
* @since 4.0.0
|
| 68 |
*/
|
| 69 |
export const toJson = input => {
|
| 70 |
try {
|
|
|
|
| 79 |
return redact(input);
|
| 80 |
};
|
| 81 |
/**
|
| 82 |
+
* Converts an unknown value to a string for diagnostics.
|
| 83 |
+
*
|
| 84 |
+
* **When to use**
|
| 85 |
+
*
|
| 86 |
+
* Use to produce a diagnostic string from a value whose runtime type is unknown.
|
| 87 |
+
*
|
| 88 |
+
* **Details**
|
| 89 |
+
*
|
| 90 |
+
* Strings are returned unchanged. Objects are formatted as JSON using the
|
| 91 |
+
* provided whitespace setting when possible, and values that cannot be
|
| 92 |
+
* formatted are converted with `String`.
|
| 93 |
+
*
|
| 94 |
+
* @category converting
|
| 95 |
* @since 2.0.0
|
| 96 |
*/
|
| 97 |
export const toStringUnknown = (u, whitespace = 2) => {
|
|
|
|
| 109 |
/**
|
| 110 |
* A base prototype object that implements the {@link Inspectable} interface.
|
| 111 |
*
|
| 112 |
+
* **When to use**
|
| 113 |
+
*
|
| 114 |
+
* Use as a prototype for plain objects that should share standard inspectable behavior.
|
| 115 |
+
*
|
| 116 |
+
* **Details**
|
| 117 |
+
*
|
| 118 |
* This object provides default implementations for the {@link Inspectable} methods.
|
| 119 |
* It can be used as a prototype for objects that want to be inspectable,
|
| 120 |
* or as a mixin to add inspection capabilities to existing objects.
|
| 121 |
*
|
| 122 |
+
* **Example** (Using the base inspectable prototype)
|
| 123 |
+
*
|
| 124 |
* ```ts
|
| 125 |
* import { Inspectable } from "effect"
|
| 126 |
*
|
|
|
|
| 139 |
* MyClass.prototype.constructor = MyClass
|
| 140 |
* ```
|
| 141 |
*
|
| 142 |
+
* @category prototypes
|
| 143 |
* @since 2.0.0
|
| 144 |
*/
|
| 145 |
export const BaseProto = {
|
|
|
|
| 154 |
}
|
| 155 |
};
|
| 156 |
/**
|
| 157 |
+
* Provides an abstract base class that implements the Inspectable interface.
|
| 158 |
+
*
|
| 159 |
+
* **When to use**
|
| 160 |
+
*
|
| 161 |
+
* Use as a base class for inspectable objects that define their own JSON representation.
|
| 162 |
+
*
|
| 163 |
+
* **Details**
|
| 164 |
*
|
| 165 |
* This class provides a convenient way to create inspectable objects by extending it.
|
| 166 |
* Subclasses only need to implement the `toJSON()` method, and they automatically
|
| 167 |
* get proper `toString()` and Node.js inspection support.
|
| 168 |
*
|
| 169 |
+
* **Example** (Extending the inspectable base class)
|
| 170 |
+
*
|
| 171 |
* ```ts
|
| 172 |
* import { Inspectable } from "effect"
|
| 173 |
*
|
|
|
|
| 195 |
* console.log(user) // In Node.js, shows the same formatted output
|
| 196 |
* ```
|
| 197 |
*
|
|
|
|
| 198 |
* @category classes
|
| 199 |
+
* @since 2.0.0
|
| 200 |
*/
|
| 201 |
export class Class {
|
| 202 |
/**
|
| 203 |
* Node.js custom inspection method.
|
| 204 |
*
|
| 205 |
+
* **When to use**
|
| 206 |
+
*
|
| 207 |
+
* Use to expose the class JSON representation to Node.js inspection.
|
| 208 |
+
*
|
| 209 |
* @since 2.0.0
|
| 210 |
*/
|
| 211 |
[NodeInspectSymbol]() {
|
|
|
|
| 214 |
/**
|
| 215 |
* Returns a formatted string representation of this object.
|
| 216 |
*
|
| 217 |
+
* **When to use**
|
| 218 |
+
*
|
| 219 |
+
* Use to format the class JSON representation as a string.
|
| 220 |
+
*
|
| 221 |
* @since 2.0.0
|
| 222 |
*/
|
| 223 |
toString() {
|
.opencode/node_modules/effect/dist/Inspectable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Inspectable.js","names":["format","formatJson","Predicate","redact","NodeInspectSymbol","Symbol","for","toJson","input","hasProperty","isFunction","length","toJSON","Array","isArray","map","toStringUnknown","u","whitespace","space","String","BaseProto","toString","Class"],"sources":["../src/Inspectable.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"Inspectable.js","names":["format","formatJson","Predicate","redact","NodeInspectSymbol","Symbol","for","toJson","input","hasProperty","isFunction","length","toJSON","Array","isArray","map","toStringUnknown","u","whitespace","space","String","BaseProto","toString","Class"],"sources":["../src/Inspectable.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;AAWA,SAASA,MAAM,EAAEC,UAAU,QAAQ,gBAAgB;AACnD,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,SAASC,MAAM,QAAQ,iBAAiB;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,OAAO,MAAMC,iBAAiB,gBAAGC,MAAM,CAACC,GAAG,CAAC,4BAA4B,CAAC;AAmFzE;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMC,MAAM,GAAIC,KAAc,IAAa;EAChD,IAAI;IACF,IACEN,SAAS,CAACO,WAAW,CAACD,KAAK,EAAE,QAAQ,CAAC,IACtCN,SAAS,CAACQ,UAAU,CAACF,KAAK,CAAC,QAAQ,CAAC,CAAC,IACrCA,KAAK,CAAC,QAAQ,CAAC,CAACG,MAAM,KAAK,CAAC,EAC5B;MACA,OAAOH,KAAK,CAACI,MAAM,EAAE;IACvB,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;MAC/B,OAAOA,KAAK,CAACO,GAAG,CAACR,MAAM,CAAC;IAC1B;EACF,CAAC,CAAC,MAAM;IACN,OAAO,gBAAgB;EACzB;EACA,OAAOJ,MAAM,CAACK,KAAK,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;AAgBA,OAAO,MAAMQ,eAAe,GAAGA,CAACC,CAAU,EAAEC,UAAA,GAA0C,CAAC,KAAY;EACjG,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;IACzB,OAAOA,CAAC;EACV;EACA,IAAI;IACF,OAAO,OAAOA,CAAC,KAAK,QAAQ,GAAGhB,UAAU,CAACgB,CAAC,EAAE;MAAEE,KAAK,EAAED;IAAU,CAAE,CAAC,GAAGE,MAAM,CAACH,CAAC,CAAC;EACjF,CAAC,CAAC,MAAM;IACN,OAAOG,MAAM,CAACH,CAAC,CAAC;EAClB;AACF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,OAAO,MAAMI,SAAS,GAAgB;EACpCT,MAAMA,CAAA;IACJ,OAAOL,MAAM,CAAC,IAAI,CAAC;EACrB,CAAC;EACD,CAACH,iBAAiB,IAAC;IACjB,OAAO,IAAI,CAACQ,MAAM,EAAE;EACtB,CAAC;EACDU,QAAQA,CAAA;IACN,OAAOtB,MAAM,CAAC,IAAI,CAACY,MAAM,EAAE,CAAC;EAC9B;CACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,OAAM,MAAgBW,KAAK;EAgBzB;;;;;;;;;EASA,CAACnB,iBAAiB,IAAC;IACjB,OAAO,IAAI,CAACQ,MAAM,EAAE;EACtB;EACA;;;;;;;;;EASAU,QAAQA,CAAA;IACN,OAAOtB,MAAM,CAAC,IAAI,CAACY,MAAM,EAAE,CAAC;EAC9B","ignoreList":[]}
|
.opencode/node_modules/effect/dist/Iterable.d.ts
CHANGED
|
@@ -1,31 +1,10 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
*
|
| 4 |
-
* Iterables
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* Unlike arrays, iterables can be lazy and potentially infinite, making them suitable
|
| 10 |
-
* for stream processing and memory-efficient data manipulation. All functions in this
|
| 11 |
-
* module preserve the lazy nature of iterables where possible.
|
| 12 |
-
*
|
| 13 |
-
* @example
|
| 14 |
-
* ```ts
|
| 15 |
-
* import { Iterable, Option } from "effect"
|
| 16 |
-
*
|
| 17 |
-
* // Create iterables
|
| 18 |
-
* const numbers = Iterable.range(1, 5)
|
| 19 |
-
* const doubled = Iterable.map(numbers, (x) => x * 2)
|
| 20 |
-
* const filtered = Iterable.filter(doubled, (x) => x > 5)
|
| 21 |
-
*
|
| 22 |
-
* console.log(Array.from(filtered)) // [6, 8, 10]
|
| 23 |
-
*
|
| 24 |
-
* // Infinite iterables
|
| 25 |
-
* const fibonacci = Iterable.unfold([0, 1], ([a, b]) => Option.some([a, [b, a + b]]))
|
| 26 |
-
* const first10 = Iterable.take(fibonacci, 10)
|
| 27 |
-
* console.log(Array.from(first10)) // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
| 28 |
-
* ```
|
| 29 |
*
|
| 30 |
* @since 2.0.0
|
| 31 |
*/
|
|
@@ -37,14 +16,14 @@ import type { NoInfer } from "./Types.ts";
|
|
| 37 |
/**
|
| 38 |
* Creates an iterable by applying a function to consecutive integers.
|
| 39 |
*
|
| 40 |
-
*
|
| 41 |
-
*
|
| 42 |
-
*
|
|
|
|
|
|
|
| 43 |
*
|
| 44 |
-
*
|
| 45 |
-
* @param options - Configuration object with optional length
|
| 46 |
*
|
| 47 |
-
* @example
|
| 48 |
* ```ts
|
| 49 |
* import { Iterable } from "effect"
|
| 50 |
*
|
|
@@ -69,16 +48,21 @@ export declare const makeBy: <A>(f: (i: number) => A, options?: {
|
|
| 69 |
readonly length?: number;
|
| 70 |
}) => Iterable<A>;
|
| 71 |
/**
|
| 72 |
-
*
|
| 73 |
*
|
| 74 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
*
|
| 76 |
-
* @example
|
| 77 |
* ```ts
|
| 78 |
-
* import {
|
| 79 |
* import * as assert from "node:assert"
|
| 80 |
*
|
| 81 |
-
* assert.deepStrictEqual(Array.from(range(1, 3)), [1, 2, 3])
|
| 82 |
* ```
|
| 83 |
*
|
| 84 |
* @category constructors
|
|
@@ -86,16 +70,19 @@ export declare const makeBy: <A>(f: (i: number) => A, options?: {
|
|
| 86 |
*/
|
| 87 |
export declare const range: (start: number, end?: number) => Iterable<number>;
|
| 88 |
/**
|
| 89 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
*
|
| 91 |
-
* **
|
| 92 |
*
|
| 93 |
-
* @example
|
| 94 |
* ```ts
|
| 95 |
-
* import {
|
| 96 |
* import * as assert from "node:assert"
|
| 97 |
*
|
| 98 |
-
* assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"])
|
| 99 |
* ```
|
| 100 |
*
|
| 101 |
* @category constructors
|
|
@@ -103,16 +90,19 @@ export declare const range: (start: number, end?: number) => Iterable<number>;
|
|
| 103 |
*/
|
| 104 |
export declare const replicate: {
|
| 105 |
/**
|
| 106 |
-
*
|
|
|
|
|
|
|
| 107 |
*
|
| 108 |
-
*
|
|
|
|
|
|
|
| 109 |
*
|
| 110 |
-
* @example
|
| 111 |
* ```ts
|
| 112 |
-
* import {
|
| 113 |
* import * as assert from "node:assert"
|
| 114 |
*
|
| 115 |
-
* assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"])
|
| 116 |
* ```
|
| 117 |
*
|
| 118 |
* @category constructors
|
|
@@ -120,16 +110,19 @@ export declare const replicate: {
|
|
| 120 |
*/
|
| 121 |
(n: number): <A>(a: A) => Iterable<A>;
|
| 122 |
/**
|
| 123 |
-
*
|
| 124 |
*
|
| 125 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
*
|
| 127 |
-
* @example
|
| 128 |
* ```ts
|
| 129 |
-
* import {
|
| 130 |
* import * as assert from "node:assert"
|
| 131 |
*
|
| 132 |
-
* assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"])
|
| 133 |
* ```
|
| 134 |
*
|
| 135 |
* @category constructors
|
|
@@ -138,22 +131,76 @@ export declare const replicate: {
|
|
| 138 |
<A>(a: A, n: number): Iterable<A>;
|
| 139 |
};
|
| 140 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
* @category constructors
|
| 142 |
* @since 4.0.0
|
| 143 |
*/
|
| 144 |
export declare const repeat: {
|
| 145 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
* @category constructors
|
| 147 |
* @since 4.0.0
|
| 148 |
*/
|
| 149 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 150 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
* @category constructors
|
| 152 |
* @since 4.0.0
|
| 153 |
*/
|
| 154 |
<A>(self: Iterable<A>, n: number): Iterable<A>;
|
| 155 |
};
|
| 156 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
* @category constructors
|
| 158 |
* @since 4.0.0
|
| 159 |
*/
|
|
@@ -161,26 +208,28 @@ export declare const forever: <A>(self: Iterable<A>) => Iterable<A>;
|
|
| 161 |
/**
|
| 162 |
* Takes a record and returns an Iterable of tuples containing its keys and values.
|
| 163 |
*
|
| 164 |
-
*
|
|
|
|
| 165 |
* ```ts
|
| 166 |
-
* import {
|
| 167 |
* import * as assert from "node:assert"
|
| 168 |
*
|
| 169 |
* const x = { a: 1, b: 2, c: 3 }
|
| 170 |
-
* assert.deepStrictEqual(Array.from(fromRecord(x)), [["a", 1], ["b", 2], [
|
| 171 |
* "c",
|
| 172 |
* 3
|
| 173 |
* ]])
|
| 174 |
* ```
|
| 175 |
*
|
| 176 |
-
* @category
|
| 177 |
* @since 2.0.0
|
| 178 |
*/
|
| 179 |
export declare const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) => Iterable<[K, A]>;
|
| 180 |
/**
|
| 181 |
-
*
|
|
|
|
|
|
|
| 182 |
*
|
| 183 |
-
* @example
|
| 184 |
* ```ts
|
| 185 |
* import { Iterable } from "effect"
|
| 186 |
*
|
|
@@ -194,14 +243,15 @@ export declare const fromRecord: <K extends string, A>(self: Readonly<Record<K,
|
|
| 194 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 195 |
* ```
|
| 196 |
*
|
| 197 |
-
* @category
|
| 198 |
* @since 2.0.0
|
| 199 |
*/
|
| 200 |
export declare const prepend: {
|
| 201 |
/**
|
| 202 |
-
*
|
|
|
|
|
|
|
| 203 |
*
|
| 204 |
-
* @example
|
| 205 |
* ```ts
|
| 206 |
* import { Iterable } from "effect"
|
| 207 |
*
|
|
@@ -215,14 +265,15 @@ export declare const prepend: {
|
|
| 215 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 216 |
* ```
|
| 217 |
*
|
| 218 |
-
* @category
|
| 219 |
* @since 2.0.0
|
| 220 |
*/
|
| 221 |
<B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 222 |
/**
|
| 223 |
-
*
|
|
|
|
|
|
|
| 224 |
*
|
| 225 |
-
* @example
|
| 226 |
* ```ts
|
| 227 |
* import { Iterable } from "effect"
|
| 228 |
*
|
|
@@ -236,7 +287,7 @@ export declare const prepend: {
|
|
| 236 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 237 |
* ```
|
| 238 |
*
|
| 239 |
-
* @category
|
| 240 |
* @since 2.0.0
|
| 241 |
*/
|
| 242 |
<A, B>(self: Iterable<A>, head: B): Iterable<A | B>;
|
|
@@ -244,7 +295,8 @@ export declare const prepend: {
|
|
| 244 |
/**
|
| 245 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 246 |
*
|
| 247 |
-
*
|
|
|
|
| 248 |
* ```ts
|
| 249 |
* import { Iterable } from "effect"
|
| 250 |
* import * as assert from "node:assert"
|
|
@@ -255,14 +307,15 @@ export declare const prepend: {
|
|
| 255 |
* )
|
| 256 |
* ```
|
| 257 |
*
|
| 258 |
-
* @category
|
| 259 |
* @since 2.0.0
|
| 260 |
*/
|
| 261 |
export declare const prependAll: {
|
| 262 |
/**
|
| 263 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 264 |
*
|
| 265 |
-
*
|
|
|
|
| 266 |
* ```ts
|
| 267 |
* import { Iterable } from "effect"
|
| 268 |
* import * as assert from "node:assert"
|
|
@@ -273,14 +326,15 @@ export declare const prependAll: {
|
|
| 273 |
* )
|
| 274 |
* ```
|
| 275 |
*
|
| 276 |
-
* @category
|
| 277 |
* @since 2.0.0
|
| 278 |
*/
|
| 279 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 280 |
/**
|
| 281 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 282 |
*
|
| 283 |
-
*
|
|
|
|
| 284 |
* ```ts
|
| 285 |
* import { Iterable } from "effect"
|
| 286 |
* import * as assert from "node:assert"
|
|
@@ -291,15 +345,31 @@ export declare const prependAll: {
|
|
| 291 |
* )
|
| 292 |
* ```
|
| 293 |
*
|
| 294 |
-
* @category
|
| 295 |
* @since 2.0.0
|
| 296 |
*/
|
| 297 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<A | B>;
|
| 298 |
};
|
| 299 |
/**
|
| 300 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
*
|
| 302 |
-
* @example
|
| 303 |
* ```ts
|
| 304 |
* import { Iterable } from "effect"
|
| 305 |
*
|
|
@@ -315,14 +385,33 @@ export declare const prependAll: {
|
|
| 315 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 316 |
* ```
|
| 317 |
*
|
| 318 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 319 |
* @since 2.0.0
|
| 320 |
*/
|
| 321 |
export declare const append: {
|
| 322 |
/**
|
| 323 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
*
|
| 325 |
-
* @example
|
| 326 |
* ```ts
|
| 327 |
* import { Iterable } from "effect"
|
| 328 |
*
|
|
@@ -338,14 +427,33 @@ export declare const append: {
|
|
| 338 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 339 |
* ```
|
| 340 |
*
|
| 341 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 342 |
* @since 2.0.0
|
| 343 |
*/
|
| 344 |
<B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 345 |
/**
|
| 346 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
*
|
| 348 |
-
* @example
|
| 349 |
* ```ts
|
| 350 |
* import { Iterable } from "effect"
|
| 351 |
*
|
|
@@ -361,7 +469,10 @@ export declare const append: {
|
|
| 361 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 362 |
* ```
|
| 363 |
*
|
| 364 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 365 |
* @since 2.0.0
|
| 366 |
*/
|
| 367 |
<A, B>(self: Iterable<A>, last: B): Iterable<A | B>;
|
|
@@ -369,7 +480,22 @@ export declare const append: {
|
|
| 369 |
/**
|
| 370 |
* Concatenates two iterables, combining their elements.
|
| 371 |
*
|
| 372 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 373 |
* ```ts
|
| 374 |
* import { Iterable } from "effect"
|
| 375 |
*
|
|
@@ -391,14 +517,32 @@ export declare const append: {
|
|
| 391 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 392 |
* ```
|
| 393 |
*
|
| 394 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 395 |
* @since 2.0.0
|
| 396 |
*/
|
| 397 |
export declare const appendAll: {
|
| 398 |
/**
|
| 399 |
* Concatenates two iterables, combining their elements.
|
| 400 |
*
|
| 401 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
* ```ts
|
| 403 |
* import { Iterable } from "effect"
|
| 404 |
*
|
|
@@ -420,14 +564,32 @@ export declare const appendAll: {
|
|
| 420 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 421 |
* ```
|
| 422 |
*
|
| 423 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 424 |
* @since 2.0.0
|
| 425 |
*/
|
| 426 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 427 |
/**
|
| 428 |
* Concatenates two iterables, combining their elements.
|
| 429 |
*
|
| 430 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
* ```ts
|
| 432 |
* import { Iterable } from "effect"
|
| 433 |
*
|
|
@@ -449,15 +611,19 @@ export declare const appendAll: {
|
|
| 449 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 450 |
* ```
|
| 451 |
*
|
| 452 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 453 |
* @since 2.0.0
|
| 454 |
*/
|
| 455 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<A | B>;
|
| 456 |
};
|
| 457 |
/**
|
| 458 |
-
*
|
|
|
|
|
|
|
| 459 |
*
|
| 460 |
-
* @example
|
| 461 |
* ```ts
|
| 462 |
* import { Iterable } from "effect"
|
| 463 |
*
|
|
@@ -482,9 +648,10 @@ export declare const appendAll: {
|
|
| 482 |
*/
|
| 483 |
export declare const scan: {
|
| 484 |
/**
|
| 485 |
-
*
|
|
|
|
|
|
|
| 486 |
*
|
| 487 |
-
* @example
|
| 488 |
* ```ts
|
| 489 |
* import { Iterable } from "effect"
|
| 490 |
*
|
|
@@ -509,9 +676,10 @@ export declare const scan: {
|
|
| 509 |
*/
|
| 510 |
<B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => Iterable<B>;
|
| 511 |
/**
|
| 512 |
-
*
|
|
|
|
|
|
|
| 513 |
*
|
| 514 |
-
* @example
|
| 515 |
* ```ts
|
| 516 |
* import { Iterable } from "effect"
|
| 517 |
*
|
|
@@ -537,15 +705,16 @@ export declare const scan: {
|
|
| 537 |
<A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): Iterable<B>;
|
| 538 |
};
|
| 539 |
/**
|
| 540 |
-
*
|
|
|
|
|
|
|
| 541 |
*
|
| 542 |
-
* @example
|
| 543 |
* ```ts
|
| 544 |
-
* import {
|
| 545 |
* import * as assert from "node:assert"
|
| 546 |
*
|
| 547 |
-
* assert.deepStrictEqual(isEmpty([]), true)
|
| 548 |
-
* assert.deepStrictEqual(isEmpty([1, 2, 3]), false)
|
| 549 |
* ```
|
| 550 |
*
|
| 551 |
* @category guards
|
|
@@ -553,9 +722,10 @@ export declare const scan: {
|
|
| 553 |
*/
|
| 554 |
export declare const isEmpty: <A>(self: Iterable<A>) => self is Iterable<never>;
|
| 555 |
/**
|
| 556 |
-
*
|
|
|
|
|
|
|
| 557 |
*
|
| 558 |
-
* @example
|
| 559 |
* ```ts
|
| 560 |
* import { Iterable } from "effect"
|
| 561 |
*
|
|
@@ -579,12 +749,12 @@ export declare const isEmpty: <A>(self: Iterable<A>) => self is Iterable<never>;
|
|
| 579 |
*/
|
| 580 |
export declare const size: <A>(self: Iterable<A>) => number;
|
| 581 |
/**
|
| 582 |
-
*
|
|
|
|
|
|
|
| 583 |
*
|
| 584 |
-
* @example
|
| 585 |
* ```ts
|
| 586 |
-
* import { Iterable } from "effect"
|
| 587 |
-
* import * as Option from "effect/Option"
|
| 588 |
*
|
| 589 |
* const numbers = [1, 2, 3]
|
| 590 |
* console.log(Iterable.head(numbers)) // Option.some(1)
|
|
@@ -608,9 +778,19 @@ export declare const size: <A>(self: Iterable<A>) => number;
|
|
| 608 |
*/
|
| 609 |
export declare const head: <A>(self: Iterable<A>) => Option<A>;
|
| 610 |
/**
|
| 611 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
*
|
| 613 |
-
* @example
|
| 614 |
* ```ts
|
| 615 |
* import { Iterable } from "effect"
|
| 616 |
*
|
|
@@ -620,13 +800,8 @@ export declare const head: <A>(self: Iterable<A>) => Option<A>;
|
|
| 620 |
* const letters = "hello"
|
| 621 |
* console.log(Iterable.headUnsafe(letters)) // "h"
|
| 622 |
*
|
| 623 |
-
* //
|
| 624 |
-
*
|
| 625 |
-
* const empty = Iterable.empty<number>()
|
| 626 |
-
* Iterable.headUnsafe(empty) // throws Error: "headUnsafe: empty iterable"
|
| 627 |
-
* } catch (error) {
|
| 628 |
-
* console.log((error as Error).message) // "headUnsafe: empty iterable"
|
| 629 |
-
* }
|
| 630 |
*
|
| 631 |
* // Use only when you're certain the iterable is non-empty
|
| 632 |
* const nonEmpty = Iterable.range(1, 10)
|
|
@@ -634,15 +809,18 @@ export declare const head: <A>(self: Iterable<A>) => Option<A>;
|
|
| 634 |
* ```
|
| 635 |
*
|
| 636 |
* @category getters
|
| 637 |
-
* @since
|
| 638 |
*/
|
| 639 |
export declare const headUnsafe: <A>(self: Iterable<A>) => A;
|
| 640 |
/**
|
| 641 |
-
*
|
| 642 |
*
|
| 643 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 644 |
*
|
| 645 |
-
* @example
|
| 646 |
* ```ts
|
| 647 |
* import { Iterable } from "effect"
|
| 648 |
*
|
|
@@ -669,11 +847,14 @@ export declare const headUnsafe: <A>(self: Iterable<A>) => A;
|
|
| 669 |
*/
|
| 670 |
export declare const take: {
|
| 671 |
/**
|
| 672 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
*
|
| 674 |
-
* **
|
| 675 |
*
|
| 676 |
-
* @example
|
| 677 |
* ```ts
|
| 678 |
* import { Iterable } from "effect"
|
| 679 |
*
|
|
@@ -700,11 +881,14 @@ export declare const take: {
|
|
| 700 |
*/
|
| 701 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 702 |
/**
|
| 703 |
-
*
|
| 704 |
*
|
| 705 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 706 |
*
|
| 707 |
-
* @example
|
| 708 |
* ```ts
|
| 709 |
* import { Iterable } from "effect"
|
| 710 |
*
|
|
@@ -732,9 +916,11 @@ export declare const take: {
|
|
| 732 |
<A>(self: Iterable<A>, n: number): Iterable<A>;
|
| 733 |
};
|
| 734 |
/**
|
| 735 |
-
*
|
|
|
|
|
|
|
|
|
|
| 736 |
*
|
| 737 |
-
* @example
|
| 738 |
* ```ts
|
| 739 |
* import { Iterable } from "effect"
|
| 740 |
*
|
|
@@ -766,9 +952,11 @@ export declare const take: {
|
|
| 766 |
*/
|
| 767 |
export declare const takeWhile: {
|
| 768 |
/**
|
| 769 |
-
*
|
|
|
|
|
|
|
|
|
|
| 770 |
*
|
| 771 |
-
* @example
|
| 772 |
* ```ts
|
| 773 |
* import { Iterable } from "effect"
|
| 774 |
*
|
|
@@ -800,9 +988,11 @@ export declare const takeWhile: {
|
|
| 800 |
*/
|
| 801 |
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Iterable<B>;
|
| 802 |
/**
|
| 803 |
-
*
|
|
|
|
|
|
|
|
|
|
| 804 |
*
|
| 805 |
-
* @example
|
| 806 |
* ```ts
|
| 807 |
* import { Iterable } from "effect"
|
| 808 |
*
|
|
@@ -834,9 +1024,11 @@ export declare const takeWhile: {
|
|
| 834 |
*/
|
| 835 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Iterable<A>;
|
| 836 |
/**
|
| 837 |
-
*
|
|
|
|
|
|
|
|
|
|
| 838 |
*
|
| 839 |
-
* @example
|
| 840 |
* ```ts
|
| 841 |
* import { Iterable } from "effect"
|
| 842 |
*
|
|
@@ -868,9 +1060,11 @@ export declare const takeWhile: {
|
|
| 868 |
*/
|
| 869 |
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Iterable<B>;
|
| 870 |
/**
|
| 871 |
-
*
|
|
|
|
|
|
|
|
|
|
| 872 |
*
|
| 873 |
-
* @example
|
| 874 |
* ```ts
|
| 875 |
* import { Iterable } from "effect"
|
| 876 |
*
|
|
@@ -903,11 +1097,14 @@ export declare const takeWhile: {
|
|
| 903 |
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Iterable<A>;
|
| 904 |
};
|
| 905 |
/**
|
| 906 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 907 |
*
|
| 908 |
-
* **
|
| 909 |
*
|
| 910 |
-
* @example
|
| 911 |
* ```ts
|
| 912 |
* import { Iterable } from "effect"
|
| 913 |
*
|
|
@@ -933,11 +1130,14 @@ export declare const takeWhile: {
|
|
| 933 |
*/
|
| 934 |
export declare const drop: {
|
| 935 |
/**
|
| 936 |
-
*
|
| 937 |
*
|
| 938 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 939 |
*
|
| 940 |
-
* @example
|
| 941 |
* ```ts
|
| 942 |
* import { Iterable } from "effect"
|
| 943 |
*
|
|
@@ -963,11 +1163,14 @@ export declare const drop: {
|
|
| 963 |
*/
|
| 964 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 965 |
/**
|
| 966 |
-
*
|
|
|
|
|
|
|
| 967 |
*
|
| 968 |
-
*
|
|
|
|
|
|
|
| 969 |
*
|
| 970 |
-
* @example
|
| 971 |
* ```ts
|
| 972 |
* import { Iterable } from "effect"
|
| 973 |
*
|
|
@@ -997,10 +1200,10 @@ export declare const drop: {
|
|
| 997 |
* Returns the first element that satisfies the specified
|
| 998 |
* predicate, or `None` if no such element exists.
|
| 999 |
*
|
| 1000 |
-
*
|
|
|
|
| 1001 |
* ```ts
|
| 1002 |
-
* import { Iterable } from "effect"
|
| 1003 |
-
* import * as Option from "effect/Option"
|
| 1004 |
*
|
| 1005 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1006 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1038,10 +1241,10 @@ export declare const findFirst: {
|
|
| 1038 |
* Returns the first element that satisfies the specified
|
| 1039 |
* predicate, or `None` if no such element exists.
|
| 1040 |
*
|
| 1041 |
-
*
|
|
|
|
| 1042 |
* ```ts
|
| 1043 |
-
* import { Iterable } from "effect"
|
| 1044 |
-
* import * as Option from "effect/Option"
|
| 1045 |
*
|
| 1046 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1047 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1079,10 +1282,10 @@ export declare const findFirst: {
|
|
| 1079 |
* Returns the first element that satisfies the specified
|
| 1080 |
* predicate, or `None` if no such element exists.
|
| 1081 |
*
|
| 1082 |
-
*
|
|
|
|
| 1083 |
* ```ts
|
| 1084 |
-
* import { Iterable } from "effect"
|
| 1085 |
-
* import * as Option from "effect/Option"
|
| 1086 |
*
|
| 1087 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1088 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1120,10 +1323,10 @@ export declare const findFirst: {
|
|
| 1120 |
* Returns the first element that satisfies the specified
|
| 1121 |
* predicate, or `None` if no such element exists.
|
| 1122 |
*
|
| 1123 |
-
*
|
|
|
|
| 1124 |
* ```ts
|
| 1125 |
-
* import { Iterable } from "effect"
|
| 1126 |
-
* import * as Option from "effect/Option"
|
| 1127 |
*
|
| 1128 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1129 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1161,10 +1364,10 @@ export declare const findFirst: {
|
|
| 1161 |
* Returns the first element that satisfies the specified
|
| 1162 |
* predicate, or `None` if no such element exists.
|
| 1163 |
*
|
| 1164 |
-
*
|
|
|
|
| 1165 |
* ```ts
|
| 1166 |
-
* import { Iterable } from "effect"
|
| 1167 |
-
* import * as Option from "effect/Option"
|
| 1168 |
*
|
| 1169 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1170 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1202,10 +1405,10 @@ export declare const findFirst: {
|
|
| 1202 |
* Returns the first element that satisfies the specified
|
| 1203 |
* predicate, or `None` if no such element exists.
|
| 1204 |
*
|
| 1205 |
-
*
|
|
|
|
| 1206 |
* ```ts
|
| 1207 |
-
* import { Iterable } from "effect"
|
| 1208 |
-
* import * as Option from "effect/Option"
|
| 1209 |
*
|
| 1210 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1211 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1243,10 +1446,10 @@ export declare const findFirst: {
|
|
| 1243 |
* Returns the first element that satisfies the specified
|
| 1244 |
* predicate, or `None` if no such element exists.
|
| 1245 |
*
|
| 1246 |
-
*
|
|
|
|
| 1247 |
* ```ts
|
| 1248 |
-
* import { Iterable } from "effect"
|
| 1249 |
-
* import * as Option from "effect/Option"
|
| 1250 |
*
|
| 1251 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1252 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -1282,9 +1485,10 @@ export declare const findFirst: {
|
|
| 1282 |
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
|
| 1283 |
};
|
| 1284 |
/**
|
| 1285 |
-
*
|
|
|
|
|
|
|
| 1286 |
*
|
| 1287 |
-
* @example
|
| 1288 |
* ```ts
|
| 1289 |
* import { Iterable } from "effect"
|
| 1290 |
*
|
|
@@ -1314,9 +1518,10 @@ export declare const findFirst: {
|
|
| 1314 |
*/
|
| 1315 |
export declare const findLast: {
|
| 1316 |
/**
|
| 1317 |
-
*
|
|
|
|
|
|
|
| 1318 |
*
|
| 1319 |
-
* @example
|
| 1320 |
* ```ts
|
| 1321 |
* import { Iterable } from "effect"
|
| 1322 |
*
|
|
@@ -1346,9 +1551,10 @@ export declare const findLast: {
|
|
| 1346 |
*/
|
| 1347 |
<A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
|
| 1348 |
/**
|
| 1349 |
-
*
|
|
|
|
|
|
|
| 1350 |
*
|
| 1351 |
-
* @example
|
| 1352 |
* ```ts
|
| 1353 |
* import { Iterable } from "effect"
|
| 1354 |
*
|
|
@@ -1378,9 +1584,10 @@ export declare const findLast: {
|
|
| 1378 |
*/
|
| 1379 |
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
|
| 1380 |
/**
|
| 1381 |
-
*
|
|
|
|
|
|
|
| 1382 |
*
|
| 1383 |
-
* @example
|
| 1384 |
* ```ts
|
| 1385 |
* import { Iterable } from "effect"
|
| 1386 |
*
|
|
@@ -1410,9 +1617,10 @@ export declare const findLast: {
|
|
| 1410 |
*/
|
| 1411 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
|
| 1412 |
/**
|
| 1413 |
-
*
|
|
|
|
|
|
|
| 1414 |
*
|
| 1415 |
-
* @example
|
| 1416 |
* ```ts
|
| 1417 |
* import { Iterable } from "effect"
|
| 1418 |
*
|
|
@@ -1442,9 +1650,10 @@ export declare const findLast: {
|
|
| 1442 |
*/
|
| 1443 |
<A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
|
| 1444 |
/**
|
| 1445 |
-
*
|
|
|
|
|
|
|
| 1446 |
*
|
| 1447 |
-
* @example
|
| 1448 |
* ```ts
|
| 1449 |
* import { Iterable } from "effect"
|
| 1450 |
*
|
|
@@ -1474,9 +1683,10 @@ export declare const findLast: {
|
|
| 1474 |
*/
|
| 1475 |
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
|
| 1476 |
/**
|
| 1477 |
-
*
|
|
|
|
|
|
|
| 1478 |
*
|
| 1479 |
-
* @example
|
| 1480 |
* ```ts
|
| 1481 |
* import { Iterable } from "effect"
|
| 1482 |
*
|
|
@@ -1509,7 +1719,8 @@ export declare const findLast: {
|
|
| 1509 |
/**
|
| 1510 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1511 |
*
|
| 1512 |
-
*
|
|
|
|
| 1513 |
* ```ts
|
| 1514 |
* import { Iterable } from "effect"
|
| 1515 |
*
|
|
@@ -1544,7 +1755,8 @@ export declare const zip: {
|
|
| 1544 |
/**
|
| 1545 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1546 |
*
|
| 1547 |
-
*
|
|
|
|
| 1548 |
* ```ts
|
| 1549 |
* import { Iterable } from "effect"
|
| 1550 |
*
|
|
@@ -1579,7 +1791,8 @@ export declare const zip: {
|
|
| 1579 |
/**
|
| 1580 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1581 |
*
|
| 1582 |
-
*
|
|
|
|
| 1583 |
* ```ts
|
| 1584 |
* import { Iterable } from "effect"
|
| 1585 |
*
|
|
@@ -1613,10 +1826,11 @@ export declare const zip: {
|
|
| 1613 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<[A, B]>;
|
| 1614 |
};
|
| 1615 |
/**
|
| 1616 |
-
*
|
| 1617 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1618 |
*
|
| 1619 |
-
*
|
|
|
|
| 1620 |
* ```ts
|
| 1621 |
* import { Iterable } from "effect"
|
| 1622 |
*
|
|
@@ -1660,10 +1874,11 @@ export declare const zip: {
|
|
| 1660 |
*/
|
| 1661 |
export declare const zipWith: {
|
| 1662 |
/**
|
| 1663 |
-
*
|
| 1664 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1665 |
*
|
| 1666 |
-
*
|
|
|
|
| 1667 |
* ```ts
|
| 1668 |
* import { Iterable } from "effect"
|
| 1669 |
*
|
|
@@ -1707,10 +1922,11 @@ export declare const zipWith: {
|
|
| 1707 |
*/
|
| 1708 |
<B, A, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Iterable<C>;
|
| 1709 |
/**
|
| 1710 |
-
*
|
| 1711 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1712 |
*
|
| 1713 |
-
*
|
|
|
|
| 1714 |
* ```ts
|
| 1715 |
* import { Iterable } from "effect"
|
| 1716 |
*
|
|
@@ -1755,10 +1971,18 @@ export declare const zipWith: {
|
|
| 1755 |
<A, B, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Iterable<C>;
|
| 1756 |
};
|
| 1757 |
/**
|
| 1758 |
-
* Places
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1759 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 1760 |
*
|
| 1761 |
-
*
|
|
|
|
| 1762 |
* ```ts
|
| 1763 |
* import { Iterable } from "effect"
|
| 1764 |
*
|
|
@@ -1788,15 +2012,23 @@ export declare const zipWith: {
|
|
| 1788 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 1789 |
* ```
|
| 1790 |
*
|
| 1791 |
-
* @category
|
| 1792 |
* @since 2.0.0
|
| 1793 |
*/
|
| 1794 |
export declare const intersperse: {
|
| 1795 |
/**
|
| 1796 |
-
* Places
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1797 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 1798 |
*
|
| 1799 |
-
*
|
|
|
|
| 1800 |
* ```ts
|
| 1801 |
* import { Iterable } from "effect"
|
| 1802 |
*
|
|
@@ -1826,15 +2058,23 @@ export declare const intersperse: {
|
|
| 1826 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 1827 |
* ```
|
| 1828 |
*
|
| 1829 |
-
* @category
|
| 1830 |
* @since 2.0.0
|
| 1831 |
*/
|
| 1832 |
<B>(middle: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 1833 |
/**
|
| 1834 |
-
* Places
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1835 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 1836 |
*
|
| 1837 |
-
*
|
|
|
|
| 1838 |
* ```ts
|
| 1839 |
* import { Iterable } from "effect"
|
| 1840 |
*
|
|
@@ -1864,7 +2104,7 @@ export declare const intersperse: {
|
|
| 1864 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 1865 |
* ```
|
| 1866 |
*
|
| 1867 |
-
* @category
|
| 1868 |
* @since 2.0.0
|
| 1869 |
*/
|
| 1870 |
<A, B>(self: Iterable<A>, middle: B): Iterable<A | B>;
|
|
@@ -1872,7 +2112,8 @@ export declare const intersperse: {
|
|
| 1872 |
/**
|
| 1873 |
* Returns a function that checks if an `Iterable` contains a given value using a provided `isEquivalent` function.
|
| 1874 |
*
|
| 1875 |
-
*
|
|
|
|
| 1876 |
* ```ts
|
| 1877 |
* import { Iterable } from "effect"
|
| 1878 |
*
|
|
@@ -1910,9 +2151,16 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
| 1910 |
(self: Iterable<A>, a: A): boolean;
|
| 1911 |
};
|
| 1912 |
/**
|
| 1913 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1914 |
*
|
| 1915 |
-
* @example
|
| 1916 |
* ```ts
|
| 1917 |
* import { Iterable } from "effect"
|
| 1918 |
*
|
|
@@ -1940,9 +2188,16 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
| 1940 |
*/
|
| 1941 |
export declare const contains: {
|
| 1942 |
/**
|
| 1943 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1944 |
*
|
| 1945 |
-
* @example
|
| 1946 |
* ```ts
|
| 1947 |
* import { Iterable } from "effect"
|
| 1948 |
*
|
|
@@ -1970,9 +2225,16 @@ export declare const contains: {
|
|
| 1970 |
*/
|
| 1971 |
<A>(a: A): (self: Iterable<A>) => boolean;
|
| 1972 |
/**
|
| 1973 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1974 |
*
|
| 1975 |
-
* @example
|
| 1976 |
* ```ts
|
| 1977 |
* import { Iterable } from "effect"
|
| 1978 |
*
|
|
@@ -2004,7 +2266,8 @@ export declare const contains: {
|
|
| 2004 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2005 |
* the `Iterable`.
|
| 2006 |
*
|
| 2007 |
-
*
|
|
|
|
| 2008 |
* ```ts
|
| 2009 |
* import { Iterable } from "effect"
|
| 2010 |
*
|
|
@@ -2043,7 +2306,8 @@ export declare const chunksOf: {
|
|
| 2043 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2044 |
* the `Iterable`.
|
| 2045 |
*
|
| 2046 |
-
*
|
|
|
|
| 2047 |
* ```ts
|
| 2048 |
* import { Iterable } from "effect"
|
| 2049 |
*
|
|
@@ -2082,7 +2346,8 @@ export declare const chunksOf: {
|
|
| 2082 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2083 |
* the `Iterable`.
|
| 2084 |
*
|
| 2085 |
-
*
|
|
|
|
| 2086 |
* ```ts
|
| 2087 |
* import { Iterable } from "effect"
|
| 2088 |
*
|
|
@@ -2119,9 +2384,10 @@ export declare const chunksOf: {
|
|
| 2119 |
<A>(self: Iterable<A>, n: number): Iterable<Array<A>>;
|
| 2120 |
};
|
| 2121 |
/**
|
| 2122 |
-
*
|
|
|
|
|
|
|
| 2123 |
*
|
| 2124 |
-
* @example
|
| 2125 |
* ```ts
|
| 2126 |
* import { Iterable } from "effect"
|
| 2127 |
*
|
|
@@ -2158,9 +2424,10 @@ export declare const chunksOf: {
|
|
| 2158 |
*/
|
| 2159 |
export declare const groupWith: {
|
| 2160 |
/**
|
| 2161 |
-
*
|
|
|
|
|
|
|
| 2162 |
*
|
| 2163 |
-
* @example
|
| 2164 |
* ```ts
|
| 2165 |
* import { Iterable } from "effect"
|
| 2166 |
*
|
|
@@ -2197,9 +2464,10 @@ export declare const groupWith: {
|
|
| 2197 |
*/
|
| 2198 |
<A>(isEquivalent: (self: A, that: A) => boolean): (self: Iterable<A>) => Iterable<NonEmptyArray<A>>;
|
| 2199 |
/**
|
| 2200 |
-
*
|
|
|
|
|
|
|
| 2201 |
*
|
| 2202 |
-
* @example
|
| 2203 |
* ```ts
|
| 2204 |
* import { Iterable } from "effect"
|
| 2205 |
*
|
|
@@ -2237,9 +2505,10 @@ export declare const groupWith: {
|
|
| 2237 |
<A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Iterable<NonEmptyArray<A>>;
|
| 2238 |
};
|
| 2239 |
/**
|
| 2240 |
-
*
|
|
|
|
|
|
|
| 2241 |
*
|
| 2242 |
-
* @example
|
| 2243 |
* ```ts
|
| 2244 |
* import { Iterable } from "effect"
|
| 2245 |
*
|
|
@@ -2270,10 +2539,16 @@ export declare const groupWith: {
|
|
| 2270 |
*/
|
| 2271 |
export declare const group: <A>(self: Iterable<A>) => Iterable<NonEmptyArray<A>>;
|
| 2272 |
/**
|
| 2273 |
-
*
|
| 2274 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2275 |
*
|
| 2276 |
-
* @example
|
| 2277 |
* ```ts
|
| 2278 |
* import { Iterable } from "effect"
|
| 2279 |
*
|
|
@@ -2315,10 +2590,16 @@ export declare const group: <A>(self: Iterable<A>) => Iterable<NonEmptyArray<A>>
|
|
| 2315 |
*/
|
| 2316 |
export declare const groupBy: {
|
| 2317 |
/**
|
| 2318 |
-
*
|
| 2319 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2320 |
*
|
| 2321 |
-
* @example
|
| 2322 |
* ```ts
|
| 2323 |
* import { Iterable } from "effect"
|
| 2324 |
*
|
|
@@ -2360,10 +2641,16 @@ export declare const groupBy: {
|
|
| 2360 |
*/
|
| 2361 |
<A, K extends string | symbol>(f: (a: A) => K): (self: Iterable<A>) => Record<Record.ReadonlyRecord.NonLiteralKey<K>, NonEmptyArray<A>>;
|
| 2362 |
/**
|
| 2363 |
-
*
|
| 2364 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2365 |
*
|
| 2366 |
-
* @example
|
| 2367 |
* ```ts
|
| 2368 |
* import { Iterable } from "effect"
|
| 2369 |
*
|
|
@@ -2408,10 +2695,13 @@ export declare const groupBy: {
|
|
| 2408 |
/**
|
| 2409 |
* Creates an empty iterable that yields no elements.
|
| 2410 |
*
|
| 2411 |
-
*
|
| 2412 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2413 |
*
|
| 2414 |
-
* @example
|
| 2415 |
* ```ts
|
| 2416 |
* import { Iterable } from "effect"
|
| 2417 |
*
|
|
@@ -2433,12 +2723,13 @@ export declare const empty: <A = never>() => Iterable<A>;
|
|
| 2433 |
/**
|
| 2434 |
* Creates an iterable containing a single element.
|
| 2435 |
*
|
| 2436 |
-
*
|
| 2437 |
-
* allowing it to be used with other iterable operations.
|
| 2438 |
*
|
| 2439 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2440 |
*
|
| 2441 |
-
* @example
|
| 2442 |
* ```ts
|
| 2443 |
* import { Iterable } from "effect"
|
| 2444 |
*
|
|
@@ -2468,15 +2759,15 @@ export declare const of: <A>(a: A) => Iterable<A>;
|
|
| 2468 |
/**
|
| 2469 |
* Transforms each element of an iterable using a function.
|
| 2470 |
*
|
|
|
|
|
|
|
| 2471 |
* This is one of the most fundamental operations for working with iterables.
|
| 2472 |
* It applies a transformation function to each element, creating a new iterable
|
| 2473 |
-
* with the transformed values. The operation is lazy
|
| 2474 |
* transformed when the iterable is consumed.
|
| 2475 |
*
|
| 2476 |
-
*
|
| 2477 |
-
* @param f - Function that transforms each element (receives value and index)
|
| 2478 |
*
|
| 2479 |
-
* @example
|
| 2480 |
* ```ts
|
| 2481 |
* import { Iterable } from "effect"
|
| 2482 |
*
|
|
@@ -2504,15 +2795,15 @@ export declare const map: {
|
|
| 2504 |
/**
|
| 2505 |
* Transforms each element of an iterable using a function.
|
| 2506 |
*
|
|
|
|
|
|
|
| 2507 |
* This is one of the most fundamental operations for working with iterables.
|
| 2508 |
* It applies a transformation function to each element, creating a new iterable
|
| 2509 |
-
* with the transformed values. The operation is lazy
|
| 2510 |
* transformed when the iterable is consumed.
|
| 2511 |
*
|
| 2512 |
-
*
|
| 2513 |
-
* @param f - Function that transforms each element (receives value and index)
|
| 2514 |
*
|
| 2515 |
-
* @example
|
| 2516 |
* ```ts
|
| 2517 |
* import { Iterable } from "effect"
|
| 2518 |
*
|
|
@@ -2540,15 +2831,15 @@ export declare const map: {
|
|
| 2540 |
/**
|
| 2541 |
* Transforms each element of an iterable using a function.
|
| 2542 |
*
|
|
|
|
|
|
|
| 2543 |
* This is one of the most fundamental operations for working with iterables.
|
| 2544 |
* It applies a transformation function to each element, creating a new iterable
|
| 2545 |
-
* with the transformed values. The operation is lazy
|
| 2546 |
* transformed when the iterable is consumed.
|
| 2547 |
*
|
| 2548 |
-
*
|
| 2549 |
-
* @param f - Function that transforms each element (receives value and index)
|
| 2550 |
*
|
| 2551 |
-
* @example
|
| 2552 |
* ```ts
|
| 2553 |
* import { Iterable } from "effect"
|
| 2554 |
*
|
|
@@ -2577,7 +2868,8 @@ export declare const map: {
|
|
| 2577 |
/**
|
| 2578 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2579 |
*
|
| 2580 |
-
*
|
|
|
|
| 2581 |
* ```ts
|
| 2582 |
* import { Iterable } from "effect"
|
| 2583 |
*
|
|
@@ -2615,7 +2907,8 @@ export declare const flatMap: {
|
|
| 2615 |
/**
|
| 2616 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2617 |
*
|
| 2618 |
-
*
|
|
|
|
| 2619 |
* ```ts
|
| 2620 |
* import { Iterable } from "effect"
|
| 2621 |
*
|
|
@@ -2653,7 +2946,8 @@ export declare const flatMap: {
|
|
| 2653 |
/**
|
| 2654 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2655 |
*
|
| 2656 |
-
*
|
|
|
|
| 2657 |
* ```ts
|
| 2658 |
* import { Iterable } from "effect"
|
| 2659 |
*
|
|
@@ -2692,7 +2986,8 @@ export declare const flatMap: {
|
|
| 2692 |
/**
|
| 2693 |
* Flattens an Iterable of Iterables into a single Iterable
|
| 2694 |
*
|
| 2695 |
-
*
|
|
|
|
| 2696 |
* ```ts
|
| 2697 |
* import { Iterable } from "effect"
|
| 2698 |
*
|
|
@@ -2725,13 +3020,16 @@ export declare const flatten: <A>(self: Iterable<Iterable<A>>) => Iterable<A>;
|
|
| 2725 |
/**
|
| 2726 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 2727 |
*
|
| 2728 |
-
*
|
| 2729 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2730 |
*
|
| 2731 |
-
* @example
|
| 2732 |
* ```ts
|
| 2733 |
-
* import { Iterable } from "effect"
|
| 2734 |
-
* import * as Result from "effect/Result"
|
| 2735 |
*
|
| 2736 |
* // Parse strings to numbers, keeping only valid ones
|
| 2737 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
@@ -2771,13 +3069,16 @@ export declare const filterMap: {
|
|
| 2771 |
/**
|
| 2772 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 2773 |
*
|
| 2774 |
-
*
|
| 2775 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2776 |
*
|
| 2777 |
-
* @example
|
| 2778 |
* ```ts
|
| 2779 |
-
* import { Iterable } from "effect"
|
| 2780 |
-
* import * as Result from "effect/Result"
|
| 2781 |
*
|
| 2782 |
* // Parse strings to numbers, keeping only valid ones
|
| 2783 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
@@ -2817,13 +3118,16 @@ export declare const filterMap: {
|
|
| 2817 |
/**
|
| 2818 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 2819 |
*
|
| 2820 |
-
*
|
| 2821 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2822 |
*
|
| 2823 |
-
* @example
|
| 2824 |
* ```ts
|
| 2825 |
-
* import { Iterable } from "effect"
|
| 2826 |
-
* import * as Result from "effect/Result"
|
| 2827 |
*
|
| 2828 |
* // Parse strings to numbers, keeping only valid ones
|
| 2829 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
@@ -2864,10 +3168,10 @@ export declare const filterMap: {
|
|
| 2864 |
/**
|
| 2865 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 2866 |
*
|
| 2867 |
-
*
|
|
|
|
| 2868 |
* ```ts
|
| 2869 |
-
* import { Iterable } from "effect"
|
| 2870 |
-
* import * as Result from "effect/Result"
|
| 2871 |
*
|
| 2872 |
* // Parse numbers until we hit an invalid one
|
| 2873 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
@@ -2901,10 +3205,10 @@ export declare const filterMapWhile: {
|
|
| 2901 |
/**
|
| 2902 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 2903 |
*
|
| 2904 |
-
*
|
|
|
|
| 2905 |
* ```ts
|
| 2906 |
-
* import { Iterable } from "effect"
|
| 2907 |
-
* import * as Result from "effect/Result"
|
| 2908 |
*
|
| 2909 |
* // Parse numbers until we hit an invalid one
|
| 2910 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
@@ -2938,10 +3242,10 @@ export declare const filterMapWhile: {
|
|
| 2938 |
/**
|
| 2939 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 2940 |
*
|
| 2941 |
-
*
|
|
|
|
| 2942 |
* ```ts
|
| 2943 |
-
* import { Iterable } from "effect"
|
| 2944 |
-
* import * as Result from "effect/Result"
|
| 2945 |
*
|
| 2946 |
* // Parse numbers until we hit an invalid one
|
| 2947 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
@@ -2976,10 +3280,10 @@ export declare const filterMapWhile: {
|
|
| 2976 |
/**
|
| 2977 |
* Retrieves the `Some` values from an `Iterable` of `Option`s.
|
| 2978 |
*
|
| 2979 |
-
*
|
|
|
|
| 2980 |
* ```ts
|
| 2981 |
-
* import { Iterable } from "effect"
|
| 2982 |
-
* import * as Option from "effect/Option"
|
| 2983 |
* import * as assert from "node:assert"
|
| 2984 |
*
|
| 2985 |
* assert.deepStrictEqual(
|
|
@@ -2995,12 +3299,13 @@ export declare const filterMapWhile: {
|
|
| 2995 |
*/
|
| 2996 |
export declare const getSomes: <A>(self: Iterable<Option<A>>) => Iterable<A>;
|
| 2997 |
/**
|
| 2998 |
-
*
|
|
|
|
|
|
|
|
|
|
| 2999 |
*
|
| 3000 |
-
* @example
|
| 3001 |
* ```ts
|
| 3002 |
-
* import { Iterable } from "effect"
|
| 3003 |
-
* import * as Result from "effect/Result"
|
| 3004 |
* import * as assert from "node:assert"
|
| 3005 |
*
|
| 3006 |
* assert.deepStrictEqual(
|
|
@@ -3016,16 +3321,17 @@ export declare const getSomes: <A>(self: Iterable<Option<A>>) => Iterable<A>;
|
|
| 3016 |
* ```
|
| 3017 |
*
|
| 3018 |
* @category filtering
|
| 3019 |
-
* @since
|
| 3020 |
*/
|
| 3021 |
export declare const getFailures: <R0, L>(self: Iterable<Result<R0, L>>) => Iterable<L>;
|
| 3022 |
/**
|
| 3023 |
-
*
|
|
|
|
|
|
|
|
|
|
| 3024 |
*
|
| 3025 |
-
* @example
|
| 3026 |
* ```ts
|
| 3027 |
-
* import { Iterable } from "effect"
|
| 3028 |
-
* import * as Result from "effect/Result"
|
| 3029 |
* import * as assert from "node:assert"
|
| 3030 |
*
|
| 3031 |
* assert.deepStrictEqual(
|
|
@@ -3041,20 +3347,20 @@ export declare const getFailures: <R0, L>(self: Iterable<Result<R0, L>>) => Iter
|
|
| 3041 |
* ```
|
| 3042 |
*
|
| 3043 |
* @category filtering
|
| 3044 |
-
* @since
|
| 3045 |
*/
|
| 3046 |
export declare const getSuccesses: <R0, L>(self: Iterable<Result<R0, L>>) => Iterable<R0>;
|
| 3047 |
/**
|
| 3048 |
* Filters an iterable to only include elements that match a predicate.
|
| 3049 |
*
|
|
|
|
|
|
|
| 3050 |
* This function creates a new iterable containing only the elements for which
|
| 3051 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3052 |
* elements are only tested when the iterable is consumed.
|
| 3053 |
*
|
| 3054 |
-
*
|
| 3055 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 3056 |
*
|
| 3057 |
-
* @example
|
| 3058 |
* ```ts
|
| 3059 |
* import { Iterable } from "effect"
|
| 3060 |
*
|
|
@@ -3091,14 +3397,14 @@ export declare const filter: {
|
|
| 3091 |
/**
|
| 3092 |
* Filters an iterable to only include elements that match a predicate.
|
| 3093 |
*
|
|
|
|
|
|
|
| 3094 |
* This function creates a new iterable containing only the elements for which
|
| 3095 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3096 |
* elements are only tested when the iterable is consumed.
|
| 3097 |
*
|
| 3098 |
-
*
|
| 3099 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 3100 |
*
|
| 3101 |
-
* @example
|
| 3102 |
* ```ts
|
| 3103 |
* import { Iterable } from "effect"
|
| 3104 |
*
|
|
@@ -3135,14 +3441,14 @@ export declare const filter: {
|
|
| 3135 |
/**
|
| 3136 |
* Filters an iterable to only include elements that match a predicate.
|
| 3137 |
*
|
|
|
|
|
|
|
| 3138 |
* This function creates a new iterable containing only the elements for which
|
| 3139 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3140 |
* elements are only tested when the iterable is consumed.
|
| 3141 |
*
|
| 3142 |
-
*
|
| 3143 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 3144 |
*
|
| 3145 |
-
* @example
|
| 3146 |
* ```ts
|
| 3147 |
* import { Iterable } from "effect"
|
| 3148 |
*
|
|
@@ -3179,14 +3485,14 @@ export declare const filter: {
|
|
| 3179 |
/**
|
| 3180 |
* Filters an iterable to only include elements that match a predicate.
|
| 3181 |
*
|
|
|
|
|
|
|
| 3182 |
* This function creates a new iterable containing only the elements for which
|
| 3183 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3184 |
* elements are only tested when the iterable is consumed.
|
| 3185 |
*
|
| 3186 |
-
*
|
| 3187 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 3188 |
*
|
| 3189 |
-
* @example
|
| 3190 |
* ```ts
|
| 3191 |
* import { Iterable } from "effect"
|
| 3192 |
*
|
|
@@ -3223,14 +3529,14 @@ export declare const filter: {
|
|
| 3223 |
/**
|
| 3224 |
* Filters an iterable to only include elements that match a predicate.
|
| 3225 |
*
|
|
|
|
|
|
|
| 3226 |
* This function creates a new iterable containing only the elements for which
|
| 3227 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3228 |
* elements are only tested when the iterable is consumed.
|
| 3229 |
*
|
| 3230 |
-
*
|
| 3231 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 3232 |
*
|
| 3233 |
-
* @example
|
| 3234 |
* ```ts
|
| 3235 |
* import { Iterable } from "effect"
|
| 3236 |
*
|
|
@@ -3268,10 +3574,13 @@ export declare const filter: {
|
|
| 3268 |
/**
|
| 3269 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3270 |
*
|
| 3271 |
-
*
|
| 3272 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3273 |
*
|
| 3274 |
-
* @example
|
| 3275 |
* ```ts
|
| 3276 |
* import { Iterable } from "effect"
|
| 3277 |
*
|
|
@@ -3305,16 +3614,19 @@ export declare const filter: {
|
|
| 3305 |
* ```
|
| 3306 |
*
|
| 3307 |
* @category sequencing
|
| 3308 |
-
* @since
|
| 3309 |
*/
|
| 3310 |
export declare const flatMapNullishOr: {
|
| 3311 |
/**
|
| 3312 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3313 |
*
|
| 3314 |
-
*
|
| 3315 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3316 |
*
|
| 3317 |
-
* @example
|
| 3318 |
* ```ts
|
| 3319 |
* import { Iterable } from "effect"
|
| 3320 |
*
|
|
@@ -3348,16 +3660,19 @@ export declare const flatMapNullishOr: {
|
|
| 3348 |
* ```
|
| 3349 |
*
|
| 3350 |
* @category sequencing
|
| 3351 |
-
* @since
|
| 3352 |
*/
|
| 3353 |
<A, B>(f: (a: A) => B): (self: Iterable<A>) => Iterable<NonNullable<B>>;
|
| 3354 |
/**
|
| 3355 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3356 |
*
|
| 3357 |
-
*
|
| 3358 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3359 |
*
|
| 3360 |
-
* @example
|
| 3361 |
* ```ts
|
| 3362 |
* import { Iterable } from "effect"
|
| 3363 |
*
|
|
@@ -3391,14 +3706,15 @@ export declare const flatMapNullishOr: {
|
|
| 3391 |
* ```
|
| 3392 |
*
|
| 3393 |
* @category sequencing
|
| 3394 |
-
* @since
|
| 3395 |
*/
|
| 3396 |
<A, B>(self: Iterable<A>, f: (a: A) => B): Iterable<NonNullable<B>>;
|
| 3397 |
};
|
| 3398 |
/**
|
| 3399 |
-
*
|
|
|
|
|
|
|
| 3400 |
*
|
| 3401 |
-
* @example
|
| 3402 |
* ```ts
|
| 3403 |
* import { Iterable } from "effect"
|
| 3404 |
*
|
|
@@ -3437,9 +3753,10 @@ export declare const flatMapNullishOr: {
|
|
| 3437 |
*/
|
| 3438 |
export declare const some: {
|
| 3439 |
/**
|
| 3440 |
-
*
|
|
|
|
|
|
|
| 3441 |
*
|
| 3442 |
-
* @example
|
| 3443 |
* ```ts
|
| 3444 |
* import { Iterable } from "effect"
|
| 3445 |
*
|
|
@@ -3478,9 +3795,10 @@ export declare const some: {
|
|
| 3478 |
*/
|
| 3479 |
<A>(predicate: (a: A, i: number) => boolean): (self: Iterable<A>) => boolean;
|
| 3480 |
/**
|
| 3481 |
-
*
|
|
|
|
|
|
|
| 3482 |
*
|
| 3483 |
-
* @example
|
| 3484 |
* ```ts
|
| 3485 |
* import { Iterable } from "effect"
|
| 3486 |
*
|
|
@@ -3523,11 +3841,14 @@ export declare const some: {
|
|
| 3523 |
* Generates an iterable by repeatedly applying a function that produces the
|
| 3524 |
* next element and state.
|
| 3525 |
*
|
|
|
|
|
|
|
| 3526 |
* This is useful for creating iterables from a generating function that
|
| 3527 |
* maintains state. The function should return `Option.some([value, nextState])`
|
| 3528 |
* to continue or `Option.none()` to stop.
|
| 3529 |
*
|
| 3530 |
-
*
|
|
|
|
| 3531 |
* ```ts
|
| 3532 |
* import { Iterable, Option } from "effect"
|
| 3533 |
*
|
|
@@ -3558,9 +3879,10 @@ export declare const some: {
|
|
| 3558 |
*/
|
| 3559 |
export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>) => Iterable<A>;
|
| 3560 |
/**
|
| 3561 |
-
*
|
|
|
|
|
|
|
| 3562 |
*
|
| 3563 |
-
* @example
|
| 3564 |
* ```ts
|
| 3565 |
* import { Iterable } from "effect"
|
| 3566 |
*
|
|
@@ -3596,9 +3918,10 @@ export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>)
|
|
| 3596 |
*/
|
| 3597 |
export declare const forEach: {
|
| 3598 |
/**
|
| 3599 |
-
*
|
|
|
|
|
|
|
| 3600 |
*
|
| 3601 |
-
* @example
|
| 3602 |
* ```ts
|
| 3603 |
* import { Iterable } from "effect"
|
| 3604 |
*
|
|
@@ -3634,9 +3957,10 @@ export declare const forEach: {
|
|
| 3634 |
*/
|
| 3635 |
<A>(f: (a: A, i: number) => void): (self: Iterable<A>) => void;
|
| 3636 |
/**
|
| 3637 |
-
*
|
|
|
|
|
|
|
| 3638 |
*
|
| 3639 |
-
* @example
|
| 3640 |
* ```ts
|
| 3641 |
* import { Iterable } from "effect"
|
| 3642 |
*
|
|
@@ -3673,12 +3997,15 @@ export declare const forEach: {
|
|
| 3673 |
<A>(self: Iterable<A>, f: (a: A, i: number) => void): void;
|
| 3674 |
};
|
| 3675 |
/**
|
| 3676 |
-
*
|
|
|
|
|
|
|
| 3677 |
*
|
| 3678 |
* This function applies a reducing function against an accumulator and each element
|
| 3679 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 3680 |
*
|
| 3681 |
-
*
|
|
|
|
| 3682 |
* ```ts
|
| 3683 |
* import { Iterable } from "effect"
|
| 3684 |
*
|
|
@@ -3722,12 +4049,15 @@ export declare const forEach: {
|
|
| 3722 |
*/
|
| 3723 |
export declare const reduce: {
|
| 3724 |
/**
|
| 3725 |
-
*
|
|
|
|
|
|
|
| 3726 |
*
|
| 3727 |
* This function applies a reducing function against an accumulator and each element
|
| 3728 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 3729 |
*
|
| 3730 |
-
*
|
|
|
|
| 3731 |
* ```ts
|
| 3732 |
* import { Iterable } from "effect"
|
| 3733 |
*
|
|
@@ -3771,12 +4101,15 @@ export declare const reduce: {
|
|
| 3771 |
*/
|
| 3772 |
<B, A>(b: B, f: (b: B, a: A, i: number) => B): (self: Iterable<A>) => B;
|
| 3773 |
/**
|
| 3774 |
-
*
|
|
|
|
|
|
|
| 3775 |
*
|
| 3776 |
* This function applies a reducing function against an accumulator and each element
|
| 3777 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 3778 |
*
|
| 3779 |
-
*
|
|
|
|
| 3780 |
* ```ts
|
| 3781 |
* import { Iterable } from "effect"
|
| 3782 |
*
|
|
@@ -3823,7 +4156,8 @@ export declare const reduce: {
|
|
| 3823 |
/**
|
| 3824 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 3825 |
*
|
| 3826 |
-
*
|
|
|
|
| 3827 |
* ```ts
|
| 3828 |
* import { Iterable } from "effect"
|
| 3829 |
*
|
|
@@ -3865,7 +4199,8 @@ export declare const dedupeAdjacentWith: {
|
|
| 3865 |
/**
|
| 3866 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 3867 |
*
|
| 3868 |
-
*
|
|
|
|
| 3869 |
* ```ts
|
| 3870 |
* import { Iterable } from "effect"
|
| 3871 |
*
|
|
@@ -3907,7 +4242,8 @@ export declare const dedupeAdjacentWith: {
|
|
| 3907 |
/**
|
| 3908 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 3909 |
*
|
| 3910 |
-
*
|
|
|
|
| 3911 |
* ```ts
|
| 3912 |
* import { Iterable } from "effect"
|
| 3913 |
*
|
|
@@ -3950,7 +4286,8 @@ export declare const dedupeAdjacentWith: {
|
|
| 3950 |
/**
|
| 3951 |
* Deduplicates adjacent elements that are identical.
|
| 3952 |
*
|
| 3953 |
-
*
|
|
|
|
| 3954 |
* ```ts
|
| 3955 |
* import { Iterable } from "effect"
|
| 3956 |
*
|
|
@@ -3988,7 +4325,8 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Iterable<A>;
|
|
| 3988 |
/**
|
| 3989 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 3990 |
*
|
| 3991 |
-
*
|
|
|
|
| 3992 |
* ```ts
|
| 3993 |
* import { Iterable } from "effect"
|
| 3994 |
*
|
|
@@ -4031,14 +4369,15 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Iterable<A>;
|
|
| 4031 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4032 |
* ```
|
| 4033 |
*
|
| 4034 |
-
* @since 2.0.0
|
| 4035 |
* @category elements
|
|
|
|
| 4036 |
*/
|
| 4037 |
export declare const cartesianWith: {
|
| 4038 |
/**
|
| 4039 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 4040 |
*
|
| 4041 |
-
*
|
|
|
|
| 4042 |
* ```ts
|
| 4043 |
* import { Iterable } from "effect"
|
| 4044 |
*
|
|
@@ -4081,14 +4420,15 @@ export declare const cartesianWith: {
|
|
| 4081 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4082 |
* ```
|
| 4083 |
*
|
| 4084 |
-
* @since 2.0.0
|
| 4085 |
* @category elements
|
|
|
|
| 4086 |
*/
|
| 4087 |
<A, B, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Iterable<C>;
|
| 4088 |
/**
|
| 4089 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 4090 |
*
|
| 4091 |
-
*
|
|
|
|
| 4092 |
* ```ts
|
| 4093 |
* import { Iterable } from "effect"
|
| 4094 |
*
|
|
@@ -4131,15 +4471,16 @@ export declare const cartesianWith: {
|
|
| 4131 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4132 |
* ```
|
| 4133 |
*
|
| 4134 |
-
* @since 2.0.0
|
| 4135 |
* @category elements
|
|
|
|
| 4136 |
*/
|
| 4137 |
<A, B, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Iterable<C>;
|
| 4138 |
};
|
| 4139 |
/**
|
| 4140 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4141 |
*
|
| 4142 |
-
*
|
|
|
|
| 4143 |
* ```ts
|
| 4144 |
* import { Iterable } from "effect"
|
| 4145 |
*
|
|
@@ -4173,14 +4514,15 @@ export declare const cartesianWith: {
|
|
| 4173 |
* console.log(Array.from(withEmpty)) // []
|
| 4174 |
* ```
|
| 4175 |
*
|
| 4176 |
-
* @since 2.0.0
|
| 4177 |
* @category elements
|
|
|
|
| 4178 |
*/
|
| 4179 |
export declare const cartesian: {
|
| 4180 |
/**
|
| 4181 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4182 |
*
|
| 4183 |
-
*
|
|
|
|
| 4184 |
* ```ts
|
| 4185 |
* import { Iterable } from "effect"
|
| 4186 |
*
|
|
@@ -4214,14 +4556,15 @@ export declare const cartesian: {
|
|
| 4214 |
* console.log(Array.from(withEmpty)) // []
|
| 4215 |
* ```
|
| 4216 |
*
|
| 4217 |
-
* @since 2.0.0
|
| 4218 |
* @category elements
|
|
|
|
| 4219 |
*/
|
| 4220 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<[A, B]>;
|
| 4221 |
/**
|
| 4222 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4223 |
*
|
| 4224 |
-
*
|
|
|
|
| 4225 |
* ```ts
|
| 4226 |
* import { Iterable } from "effect"
|
| 4227 |
*
|
|
@@ -4255,15 +4598,15 @@ export declare const cartesian: {
|
|
| 4255 |
* console.log(Array.from(withEmpty)) // []
|
| 4256 |
* ```
|
| 4257 |
*
|
| 4258 |
-
* @since 2.0.0
|
| 4259 |
* @category elements
|
|
|
|
| 4260 |
*/
|
| 4261 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<[A, B]>;
|
| 4262 |
};
|
| 4263 |
/**
|
| 4264 |
-
*
|
| 4265 |
*
|
| 4266 |
-
* **Example**
|
| 4267 |
*
|
| 4268 |
* ```ts
|
| 4269 |
* import { Iterable } from "effect"
|
|
@@ -4277,9 +4620,9 @@ export declare const cartesian: {
|
|
| 4277 |
*/
|
| 4278 |
export declare const countBy: {
|
| 4279 |
/**
|
| 4280 |
-
*
|
| 4281 |
*
|
| 4282 |
-
* **Example**
|
| 4283 |
*
|
| 4284 |
* ```ts
|
| 4285 |
* import { Iterable } from "effect"
|
|
@@ -4293,9 +4636,9 @@ export declare const countBy: {
|
|
| 4293 |
*/
|
| 4294 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => number;
|
| 4295 |
/**
|
| 4296 |
-
*
|
| 4297 |
*
|
| 4298 |
-
* **Example**
|
| 4299 |
*
|
| 4300 |
* ```ts
|
| 4301 |
* import { Iterable } from "effect"
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Works with JavaScript values that implement `[Symbol.iterator]`.
|
| 3 |
*
|
| 4 |
+
* Iterables include arrays, strings, generators, sets, and custom lazy
|
| 5 |
+
* sequences. The helpers in this module let code transform, search, group, and
|
| 6 |
+
* fold iterable values while preserving the input as an iterable instead of
|
| 7 |
+
* forcing an array first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
*
|
| 9 |
* @since 2.0.0
|
| 10 |
*/
|
|
|
|
| 16 |
/**
|
| 17 |
* Creates an iterable by applying a function to consecutive integers.
|
| 18 |
*
|
| 19 |
+
* **Details**
|
| 20 |
+
*
|
| 21 |
+
* The function is called with each index starting from `0`. If no length is
|
| 22 |
+
* specified, the iterable is infinite. This is useful for generating
|
| 23 |
+
* sequences, patterns, or any indexed data.
|
| 24 |
*
|
| 25 |
+
* **Example** (Generating values by index)
|
|
|
|
| 26 |
*
|
|
|
|
| 27 |
* ```ts
|
| 28 |
* import { Iterable } from "effect"
|
| 29 |
*
|
|
|
|
| 48 |
readonly length?: number;
|
| 49 |
}) => Iterable<A>;
|
| 50 |
/**
|
| 51 |
+
* Returns an iterable of integers starting at `start` and increasing by `1`.
|
| 52 |
*
|
| 53 |
+
* **Details**
|
| 54 |
+
*
|
| 55 |
+
* When `end` is provided and `start <= end`, both endpoints are included. When
|
| 56 |
+
* `end` is omitted, the iterable is unbounded. When `start > end`, the
|
| 57 |
+
* iterable contains only `start`.
|
| 58 |
+
*
|
| 59 |
+
* **Example** (Creating a range)
|
| 60 |
*
|
|
|
|
| 61 |
* ```ts
|
| 62 |
+
* import { Iterable } from "effect"
|
| 63 |
* import * as assert from "node:assert"
|
| 64 |
*
|
| 65 |
+
* assert.deepStrictEqual(Array.from(Iterable.range(1, 3)), [1, 2, 3])
|
| 66 |
* ```
|
| 67 |
*
|
| 68 |
* @category constructors
|
|
|
|
| 70 |
*/
|
| 71 |
export declare const range: (start: number, end?: number) => Iterable<number>;
|
| 72 |
/**
|
| 73 |
+
* Returns a `Iterable` containing a value repeated the specified number of times.
|
| 74 |
+
*
|
| 75 |
+
* **Details**
|
| 76 |
+
*
|
| 77 |
+
* `n` is normalized to an integer greater than or equal to `1`.
|
| 78 |
*
|
| 79 |
+
* **Example** (Repeating a value)
|
| 80 |
*
|
|
|
|
| 81 |
* ```ts
|
| 82 |
+
* import { Iterable } from "effect"
|
| 83 |
* import * as assert from "node:assert"
|
| 84 |
*
|
| 85 |
+
* assert.deepStrictEqual(Array.from(Iterable.replicate("a", 3)), ["a", "a", "a"])
|
| 86 |
* ```
|
| 87 |
*
|
| 88 |
* @category constructors
|
|
|
|
| 90 |
*/
|
| 91 |
export declare const replicate: {
|
| 92 |
/**
|
| 93 |
+
* Returns a `Iterable` containing a value repeated the specified number of times.
|
| 94 |
+
*
|
| 95 |
+
* **Details**
|
| 96 |
*
|
| 97 |
+
* `n` is normalized to an integer greater than or equal to `1`.
|
| 98 |
+
*
|
| 99 |
+
* **Example** (Repeating a value)
|
| 100 |
*
|
|
|
|
| 101 |
* ```ts
|
| 102 |
+
* import { Iterable } from "effect"
|
| 103 |
* import * as assert from "node:assert"
|
| 104 |
*
|
| 105 |
+
* assert.deepStrictEqual(Array.from(Iterable.replicate("a", 3)), ["a", "a", "a"])
|
| 106 |
* ```
|
| 107 |
*
|
| 108 |
* @category constructors
|
|
|
|
| 110 |
*/
|
| 111 |
(n: number): <A>(a: A) => Iterable<A>;
|
| 112 |
/**
|
| 113 |
+
* Returns a `Iterable` containing a value repeated the specified number of times.
|
| 114 |
*
|
| 115 |
+
* **Details**
|
| 116 |
+
*
|
| 117 |
+
* `n` is normalized to an integer greater than or equal to `1`.
|
| 118 |
+
*
|
| 119 |
+
* **Example** (Repeating a value)
|
| 120 |
*
|
|
|
|
| 121 |
* ```ts
|
| 122 |
+
* import { Iterable } from "effect"
|
| 123 |
* import * as assert from "node:assert"
|
| 124 |
*
|
| 125 |
+
* assert.deepStrictEqual(Array.from(Iterable.replicate("a", 3)), ["a", "a", "a"])
|
| 126 |
* ```
|
| 127 |
*
|
| 128 |
* @category constructors
|
|
|
|
| 131 |
<A>(a: A, n: number): Iterable<A>;
|
| 132 |
};
|
| 133 |
/**
|
| 134 |
+
* Repeats an iterable `n` times, yielding the full contents of `self` for each
|
| 135 |
+
* repetition.
|
| 136 |
+
*
|
| 137 |
+
* **When to use**
|
| 138 |
+
*
|
| 139 |
+
* Use to repeat an iterable's contents a specific number of times.
|
| 140 |
+
*
|
| 141 |
+
* **Details**
|
| 142 |
+
*
|
| 143 |
+
* The result is lazy. Each repetition obtains a new iterator from `self`.
|
| 144 |
+
*
|
| 145 |
+
* @see {@link forever} for repeating without an upper bound
|
| 146 |
+
* @see {@link replicate} for repeating a single value
|
| 147 |
* @category constructors
|
| 148 |
* @since 4.0.0
|
| 149 |
*/
|
| 150 |
export declare const repeat: {
|
| 151 |
/**
|
| 152 |
+
* Repeats an iterable `n` times, yielding the full contents of `self` for each
|
| 153 |
+
* repetition.
|
| 154 |
+
*
|
| 155 |
+
* **When to use**
|
| 156 |
+
*
|
| 157 |
+
* Use to repeat an iterable's contents a specific number of times.
|
| 158 |
+
*
|
| 159 |
+
* **Details**
|
| 160 |
+
*
|
| 161 |
+
* The result is lazy. Each repetition obtains a new iterator from `self`.
|
| 162 |
+
*
|
| 163 |
+
* @see {@link forever} for repeating without an upper bound
|
| 164 |
+
* @see {@link replicate} for repeating a single value
|
| 165 |
* @category constructors
|
| 166 |
* @since 4.0.0
|
| 167 |
*/
|
| 168 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 169 |
/**
|
| 170 |
+
* Repeats an iterable `n` times, yielding the full contents of `self` for each
|
| 171 |
+
* repetition.
|
| 172 |
+
*
|
| 173 |
+
* **When to use**
|
| 174 |
+
*
|
| 175 |
+
* Use to repeat an iterable's contents a specific number of times.
|
| 176 |
+
*
|
| 177 |
+
* **Details**
|
| 178 |
+
*
|
| 179 |
+
* The result is lazy. Each repetition obtains a new iterator from `self`.
|
| 180 |
+
*
|
| 181 |
+
* @see {@link forever} for repeating without an upper bound
|
| 182 |
+
* @see {@link replicate} for repeating a single value
|
| 183 |
* @category constructors
|
| 184 |
* @since 4.0.0
|
| 185 |
*/
|
| 186 |
<A>(self: Iterable<A>, n: number): Iterable<A>;
|
| 187 |
};
|
| 188 |
/**
|
| 189 |
+
* Repeats an iterable without an upper bound.
|
| 190 |
+
*
|
| 191 |
+
* **When to use**
|
| 192 |
+
*
|
| 193 |
+
* Use to cycle a reusable iterable without an upper bound when a downstream
|
| 194 |
+
* consumer controls how many values are taken.
|
| 195 |
+
*
|
| 196 |
+
* **Gotchas**
|
| 197 |
+
*
|
| 198 |
+
* The returned iterable is lazy and should usually be bounded with `take` or
|
| 199 |
+
* another terminating consumer before materializing it.
|
| 200 |
+
*
|
| 201 |
+
* @see {@link repeat} for repeating an iterable a specific number of times
|
| 202 |
+
* @see {@link take} for bounding the unbounded result before materializing it
|
| 203 |
+
*
|
| 204 |
* @category constructors
|
| 205 |
* @since 4.0.0
|
| 206 |
*/
|
|
|
|
| 208 |
/**
|
| 209 |
* Takes a record and returns an Iterable of tuples containing its keys and values.
|
| 210 |
*
|
| 211 |
+
* **Example** (Converting a record to entries)
|
| 212 |
+
*
|
| 213 |
* ```ts
|
| 214 |
+
* import { Iterable } from "effect"
|
| 215 |
* import * as assert from "node:assert"
|
| 216 |
*
|
| 217 |
* const x = { a: 1, b: 2, c: 3 }
|
| 218 |
+
* assert.deepStrictEqual(Array.from(Iterable.fromRecord(x)), [["a", 1], ["b", 2], [
|
| 219 |
* "c",
|
| 220 |
* 3
|
| 221 |
* ]])
|
| 222 |
* ```
|
| 223 |
*
|
| 224 |
+
* @category converting
|
| 225 |
* @since 2.0.0
|
| 226 |
*/
|
| 227 |
export declare const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) => Iterable<[K, A]>;
|
| 228 |
/**
|
| 229 |
+
* Prepends an element to the front of an `Iterable`, creating a new `Iterable`.
|
| 230 |
+
*
|
| 231 |
+
* **Example** (Prepending an element)
|
| 232 |
*
|
|
|
|
| 233 |
* ```ts
|
| 234 |
* import { Iterable } from "effect"
|
| 235 |
*
|
|
|
|
| 243 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 244 |
* ```
|
| 245 |
*
|
| 246 |
+
* @category combining
|
| 247 |
* @since 2.0.0
|
| 248 |
*/
|
| 249 |
export declare const prepend: {
|
| 250 |
/**
|
| 251 |
+
* Prepends an element to the front of an `Iterable`, creating a new `Iterable`.
|
| 252 |
+
*
|
| 253 |
+
* **Example** (Prepending an element)
|
| 254 |
*
|
|
|
|
| 255 |
* ```ts
|
| 256 |
* import { Iterable } from "effect"
|
| 257 |
*
|
|
|
|
| 265 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 266 |
* ```
|
| 267 |
*
|
| 268 |
+
* @category combining
|
| 269 |
* @since 2.0.0
|
| 270 |
*/
|
| 271 |
<B>(head: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 272 |
/**
|
| 273 |
+
* Prepends an element to the front of an `Iterable`, creating a new `Iterable`.
|
| 274 |
+
*
|
| 275 |
+
* **Example** (Prepending an element)
|
| 276 |
*
|
|
|
|
| 277 |
* ```ts
|
| 278 |
* import { Iterable } from "effect"
|
| 279 |
*
|
|
|
|
| 287 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 288 |
* ```
|
| 289 |
*
|
| 290 |
+
* @category combining
|
| 291 |
* @since 2.0.0
|
| 292 |
*/
|
| 293 |
<A, B>(self: Iterable<A>, head: B): Iterable<A | B>;
|
|
|
|
| 295 |
/**
|
| 296 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 297 |
*
|
| 298 |
+
* **Example** (Prepending another iterable)
|
| 299 |
+
*
|
| 300 |
* ```ts
|
| 301 |
* import { Iterable } from "effect"
|
| 302 |
* import * as assert from "node:assert"
|
|
|
|
| 307 |
* )
|
| 308 |
* ```
|
| 309 |
*
|
| 310 |
+
* @category combining
|
| 311 |
* @since 2.0.0
|
| 312 |
*/
|
| 313 |
export declare const prependAll: {
|
| 314 |
/**
|
| 315 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 316 |
*
|
| 317 |
+
* **Example** (Prepending another iterable)
|
| 318 |
+
*
|
| 319 |
* ```ts
|
| 320 |
* import { Iterable } from "effect"
|
| 321 |
* import * as assert from "node:assert"
|
|
|
|
| 326 |
* )
|
| 327 |
* ```
|
| 328 |
*
|
| 329 |
+
* @category combining
|
| 330 |
* @since 2.0.0
|
| 331 |
*/
|
| 332 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 333 |
/**
|
| 334 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 335 |
*
|
| 336 |
+
* **Example** (Prepending another iterable)
|
| 337 |
+
*
|
| 338 |
* ```ts
|
| 339 |
* import { Iterable } from "effect"
|
| 340 |
* import * as assert from "node:assert"
|
|
|
|
| 345 |
* )
|
| 346 |
* ```
|
| 347 |
*
|
| 348 |
+
* @category combining
|
| 349 |
* @since 2.0.0
|
| 350 |
*/
|
| 351 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<A | B>;
|
| 352 |
};
|
| 353 |
/**
|
| 354 |
+
* Appends an element to the end of an `Iterable`, creating a new `Iterable`.
|
| 355 |
+
*
|
| 356 |
+
* **When to use**
|
| 357 |
+
*
|
| 358 |
+
* Use to add one element after all elements of an iterable while keeping the
|
| 359 |
+
* result as a lazy `Iterable`.
|
| 360 |
+
*
|
| 361 |
+
* **Details**
|
| 362 |
+
*
|
| 363 |
+
* The result yields every element from `self` first, then yields `last` after
|
| 364 |
+
* `self` is exhausted.
|
| 365 |
+
*
|
| 366 |
+
* **Gotchas**
|
| 367 |
+
*
|
| 368 |
+
* If `self` is infinite or never completes, the appended element is never
|
| 369 |
+
* reached.
|
| 370 |
+
*
|
| 371 |
+
* **Example** (Appending an element)
|
| 372 |
*
|
|
|
|
| 373 |
* ```ts
|
| 374 |
* import { Iterable } from "effect"
|
| 375 |
*
|
|
|
|
| 385 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 386 |
* ```
|
| 387 |
*
|
| 388 |
+
* @see {@link prepend} for adding one element before the existing elements
|
| 389 |
+
* @see {@link appendAll} for appending all elements from another iterable
|
| 390 |
+
*
|
| 391 |
+
* @category combining
|
| 392 |
* @since 2.0.0
|
| 393 |
*/
|
| 394 |
export declare const append: {
|
| 395 |
/**
|
| 396 |
+
* Appends an element to the end of an `Iterable`, creating a new `Iterable`.
|
| 397 |
+
*
|
| 398 |
+
* **When to use**
|
| 399 |
+
*
|
| 400 |
+
* Use to add one element after all elements of an iterable while keeping the
|
| 401 |
+
* result as a lazy `Iterable`.
|
| 402 |
+
*
|
| 403 |
+
* **Details**
|
| 404 |
+
*
|
| 405 |
+
* The result yields every element from `self` first, then yields `last` after
|
| 406 |
+
* `self` is exhausted.
|
| 407 |
+
*
|
| 408 |
+
* **Gotchas**
|
| 409 |
+
*
|
| 410 |
+
* If `self` is infinite or never completes, the appended element is never
|
| 411 |
+
* reached.
|
| 412 |
+
*
|
| 413 |
+
* **Example** (Appending an element)
|
| 414 |
*
|
|
|
|
| 415 |
* ```ts
|
| 416 |
* import { Iterable } from "effect"
|
| 417 |
*
|
|
|
|
| 427 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 428 |
* ```
|
| 429 |
*
|
| 430 |
+
* @see {@link prepend} for adding one element before the existing elements
|
| 431 |
+
* @see {@link appendAll} for appending all elements from another iterable
|
| 432 |
+
*
|
| 433 |
+
* @category combining
|
| 434 |
* @since 2.0.0
|
| 435 |
*/
|
| 436 |
<B>(last: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 437 |
/**
|
| 438 |
+
* Appends an element to the end of an `Iterable`, creating a new `Iterable`.
|
| 439 |
+
*
|
| 440 |
+
* **When to use**
|
| 441 |
+
*
|
| 442 |
+
* Use to add one element after all elements of an iterable while keeping the
|
| 443 |
+
* result as a lazy `Iterable`.
|
| 444 |
+
*
|
| 445 |
+
* **Details**
|
| 446 |
+
*
|
| 447 |
+
* The result yields every element from `self` first, then yields `last` after
|
| 448 |
+
* `self` is exhausted.
|
| 449 |
+
*
|
| 450 |
+
* **Gotchas**
|
| 451 |
+
*
|
| 452 |
+
* If `self` is infinite or never completes, the appended element is never
|
| 453 |
+
* reached.
|
| 454 |
+
*
|
| 455 |
+
* **Example** (Appending an element)
|
| 456 |
*
|
|
|
|
| 457 |
* ```ts
|
| 458 |
* import { Iterable } from "effect"
|
| 459 |
*
|
|
|
|
| 469 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 470 |
* ```
|
| 471 |
*
|
| 472 |
+
* @see {@link prepend} for adding one element before the existing elements
|
| 473 |
+
* @see {@link appendAll} for appending all elements from another iterable
|
| 474 |
+
*
|
| 475 |
+
* @category combining
|
| 476 |
* @since 2.0.0
|
| 477 |
*/
|
| 478 |
<A, B>(self: Iterable<A>, last: B): Iterable<A | B>;
|
|
|
|
| 480 |
/**
|
| 481 |
* Concatenates two iterables, combining their elements.
|
| 482 |
*
|
| 483 |
+
* **When to use**
|
| 484 |
+
*
|
| 485 |
+
* Use to lazily concatenate two iterables while preserving order, yielding all
|
| 486 |
+
* elements from `self` before `that`.
|
| 487 |
+
*
|
| 488 |
+
* **Details**
|
| 489 |
+
*
|
| 490 |
+
* The result is lazy. The iterator for `that` is not created or read until
|
| 491 |
+
* `self` is exhausted.
|
| 492 |
+
*
|
| 493 |
+
* **Gotchas**
|
| 494 |
+
*
|
| 495 |
+
* If `self` is infinite or never completes, `that` is never reached.
|
| 496 |
+
*
|
| 497 |
+
* **Example** (Concatenating iterables)
|
| 498 |
+
*
|
| 499 |
* ```ts
|
| 500 |
* import { Iterable } from "effect"
|
| 501 |
*
|
|
|
|
| 517 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 518 |
* ```
|
| 519 |
*
|
| 520 |
+
* @see {@link append} for appending one value instead of another iterable
|
| 521 |
+
* @see {@link prependAll} for yielding another iterable before `self`
|
| 522 |
+
*
|
| 523 |
+
* @category combining
|
| 524 |
* @since 2.0.0
|
| 525 |
*/
|
| 526 |
export declare const appendAll: {
|
| 527 |
/**
|
| 528 |
* Concatenates two iterables, combining their elements.
|
| 529 |
*
|
| 530 |
+
* **When to use**
|
| 531 |
+
*
|
| 532 |
+
* Use to lazily concatenate two iterables while preserving order, yielding all
|
| 533 |
+
* elements from `self` before `that`.
|
| 534 |
+
*
|
| 535 |
+
* **Details**
|
| 536 |
+
*
|
| 537 |
+
* The result is lazy. The iterator for `that` is not created or read until
|
| 538 |
+
* `self` is exhausted.
|
| 539 |
+
*
|
| 540 |
+
* **Gotchas**
|
| 541 |
+
*
|
| 542 |
+
* If `self` is infinite or never completes, `that` is never reached.
|
| 543 |
+
*
|
| 544 |
+
* **Example** (Concatenating iterables)
|
| 545 |
+
*
|
| 546 |
* ```ts
|
| 547 |
* import { Iterable } from "effect"
|
| 548 |
*
|
|
|
|
| 564 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 565 |
* ```
|
| 566 |
*
|
| 567 |
+
* @see {@link append} for appending one value instead of another iterable
|
| 568 |
+
* @see {@link prependAll} for yielding another iterable before `self`
|
| 569 |
+
*
|
| 570 |
+
* @category combining
|
| 571 |
* @since 2.0.0
|
| 572 |
*/
|
| 573 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 574 |
/**
|
| 575 |
* Concatenates two iterables, combining their elements.
|
| 576 |
*
|
| 577 |
+
* **When to use**
|
| 578 |
+
*
|
| 579 |
+
* Use to lazily concatenate two iterables while preserving order, yielding all
|
| 580 |
+
* elements from `self` before `that`.
|
| 581 |
+
*
|
| 582 |
+
* **Details**
|
| 583 |
+
*
|
| 584 |
+
* The result is lazy. The iterator for `that` is not created or read until
|
| 585 |
+
* `self` is exhausted.
|
| 586 |
+
*
|
| 587 |
+
* **Gotchas**
|
| 588 |
+
*
|
| 589 |
+
* If `self` is infinite or never completes, `that` is never reached.
|
| 590 |
+
*
|
| 591 |
+
* **Example** (Concatenating iterables)
|
| 592 |
+
*
|
| 593 |
* ```ts
|
| 594 |
* import { Iterable } from "effect"
|
| 595 |
*
|
|
|
|
| 611 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 612 |
* ```
|
| 613 |
*
|
| 614 |
+
* @see {@link append} for appending one value instead of another iterable
|
| 615 |
+
* @see {@link prependAll} for yielding another iterable before `self`
|
| 616 |
+
*
|
| 617 |
+
* @category combining
|
| 618 |
* @since 2.0.0
|
| 619 |
*/
|
| 620 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<A | B>;
|
| 621 |
};
|
| 622 |
/**
|
| 623 |
+
* Reduces an `Iterable` from the left, keeping all intermediate results instead of only the final result.
|
| 624 |
+
*
|
| 625 |
+
* **Example** (Tracking running results)
|
| 626 |
*
|
|
|
|
| 627 |
* ```ts
|
| 628 |
* import { Iterable } from "effect"
|
| 629 |
*
|
|
|
|
| 648 |
*/
|
| 649 |
export declare const scan: {
|
| 650 |
/**
|
| 651 |
+
* Reduces an `Iterable` from the left, keeping all intermediate results instead of only the final result.
|
| 652 |
+
*
|
| 653 |
+
* **Example** (Tracking running results)
|
| 654 |
*
|
|
|
|
| 655 |
* ```ts
|
| 656 |
* import { Iterable } from "effect"
|
| 657 |
*
|
|
|
|
| 676 |
*/
|
| 677 |
<B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => Iterable<B>;
|
| 678 |
/**
|
| 679 |
+
* Reduces an `Iterable` from the left, keeping all intermediate results instead of only the final result.
|
| 680 |
+
*
|
| 681 |
+
* **Example** (Tracking running results)
|
| 682 |
*
|
|
|
|
| 683 |
* ```ts
|
| 684 |
* import { Iterable } from "effect"
|
| 685 |
*
|
|
|
|
| 705 |
<A, B>(self: Iterable<A>, b: B, f: (b: B, a: A) => B): Iterable<B>;
|
| 706 |
};
|
| 707 |
/**
|
| 708 |
+
* Checks whether an `Iterable` is empty.
|
| 709 |
+
*
|
| 710 |
+
* **Example** (Checking for emptiness)
|
| 711 |
*
|
|
|
|
| 712 |
* ```ts
|
| 713 |
+
* import { Iterable } from "effect"
|
| 714 |
* import * as assert from "node:assert"
|
| 715 |
*
|
| 716 |
+
* assert.deepStrictEqual(Iterable.isEmpty([]), true)
|
| 717 |
+
* assert.deepStrictEqual(Iterable.isEmpty([1, 2, 3]), false)
|
| 718 |
* ```
|
| 719 |
*
|
| 720 |
* @category guards
|
|
|
|
| 722 |
*/
|
| 723 |
export declare const isEmpty: <A>(self: Iterable<A>) => self is Iterable<never>;
|
| 724 |
/**
|
| 725 |
+
* Returns the number of elements in a `Iterable`.
|
| 726 |
+
*
|
| 727 |
+
* **Example** (Counting iterable elements)
|
| 728 |
*
|
|
|
|
| 729 |
* ```ts
|
| 730 |
* import { Iterable } from "effect"
|
| 731 |
*
|
|
|
|
| 749 |
*/
|
| 750 |
export declare const size: <A>(self: Iterable<A>) => number;
|
| 751 |
/**
|
| 752 |
+
* Gets the first element of a `Iterable` safely, or `None` if the `Iterable` is empty.
|
| 753 |
+
*
|
| 754 |
+
* **Example** (Getting the first element)
|
| 755 |
*
|
|
|
|
| 756 |
* ```ts
|
| 757 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 758 |
*
|
| 759 |
* const numbers = [1, 2, 3]
|
| 760 |
* console.log(Iterable.head(numbers)) // Option.some(1)
|
|
|
|
| 778 |
*/
|
| 779 |
export declare const head: <A>(self: Iterable<A>) => Option<A>;
|
| 780 |
/**
|
| 781 |
+
* Gets the first element of an `Iterable` without returning an `Option`.
|
| 782 |
+
*
|
| 783 |
+
* **When to use**
|
| 784 |
+
*
|
| 785 |
+
* Use when the `Iterable` is known to be non-empty and direct access to the
|
| 786 |
+
* first element is preferred over handling `Option.none`.
|
| 787 |
+
*
|
| 788 |
+
* **Gotchas**
|
| 789 |
+
*
|
| 790 |
+
* Throws if the `Iterable` is empty.
|
| 791 |
+
*
|
| 792 |
+
* **Example** (Getting the first element unsafely)
|
| 793 |
*
|
|
|
|
| 794 |
* ```ts
|
| 795 |
* import { Iterable } from "effect"
|
| 796 |
*
|
|
|
|
| 800 |
* const letters = "hello"
|
| 801 |
* console.log(Iterable.headUnsafe(letters)) // "h"
|
| 802 |
*
|
| 803 |
+
* // Iterable.headUnsafe(Iterable.empty<number>())
|
| 804 |
+
* // throws Error: "headUnsafe: empty iterable"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 805 |
*
|
| 806 |
* // Use only when you're certain the iterable is non-empty
|
| 807 |
* const nonEmpty = Iterable.range(1, 10)
|
|
|
|
| 809 |
* ```
|
| 810 |
*
|
| 811 |
* @category getters
|
| 812 |
+
* @since 4.0.0
|
| 813 |
*/
|
| 814 |
export declare const headUnsafe: <A>(self: Iterable<A>) => A;
|
| 815 |
/**
|
| 816 |
+
* Keeps only a max number of elements from the start of an `Iterable`, creating a new `Iterable`.
|
| 817 |
*
|
| 818 |
+
* **Details**
|
| 819 |
+
*
|
| 820 |
+
* `n` is normalized to a non-negative integer.
|
| 821 |
+
*
|
| 822 |
+
* **Example** (Taking from the start)
|
| 823 |
*
|
|
|
|
| 824 |
* ```ts
|
| 825 |
* import { Iterable } from "effect"
|
| 826 |
*
|
|
|
|
| 847 |
*/
|
| 848 |
export declare const take: {
|
| 849 |
/**
|
| 850 |
+
* Keeps only a max number of elements from the start of an `Iterable`, creating a new `Iterable`.
|
| 851 |
+
*
|
| 852 |
+
* **Details**
|
| 853 |
+
*
|
| 854 |
+
* `n` is normalized to a non-negative integer.
|
| 855 |
*
|
| 856 |
+
* **Example** (Taking from the start)
|
| 857 |
*
|
|
|
|
| 858 |
* ```ts
|
| 859 |
* import { Iterable } from "effect"
|
| 860 |
*
|
|
|
|
| 881 |
*/
|
| 882 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 883 |
/**
|
| 884 |
+
* Keeps only a max number of elements from the start of an `Iterable`, creating a new `Iterable`.
|
| 885 |
*
|
| 886 |
+
* **Details**
|
| 887 |
+
*
|
| 888 |
+
* `n` is normalized to a non-negative integer.
|
| 889 |
+
*
|
| 890 |
+
* **Example** (Taking from the start)
|
| 891 |
*
|
|
|
|
| 892 |
* ```ts
|
| 893 |
* import { Iterable } from "effect"
|
| 894 |
*
|
|
|
|
| 916 |
<A>(self: Iterable<A>, n: number): Iterable<A>;
|
| 917 |
};
|
| 918 |
/**
|
| 919 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 920 |
+
* specified predicate.
|
| 921 |
+
*
|
| 922 |
+
* **Example** (Taking while a predicate holds)
|
| 923 |
*
|
|
|
|
| 924 |
* ```ts
|
| 925 |
* import { Iterable } from "effect"
|
| 926 |
*
|
|
|
|
| 952 |
*/
|
| 953 |
export declare const takeWhile: {
|
| 954 |
/**
|
| 955 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 956 |
+
* specified predicate.
|
| 957 |
+
*
|
| 958 |
+
* **Example** (Taking while a predicate holds)
|
| 959 |
*
|
|
|
|
| 960 |
* ```ts
|
| 961 |
* import { Iterable } from "effect"
|
| 962 |
*
|
|
|
|
| 988 |
*/
|
| 989 |
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Iterable<B>;
|
| 990 |
/**
|
| 991 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 992 |
+
* specified predicate.
|
| 993 |
+
*
|
| 994 |
+
* **Example** (Taking while a predicate holds)
|
| 995 |
*
|
|
|
|
| 996 |
* ```ts
|
| 997 |
* import { Iterable } from "effect"
|
| 998 |
*
|
|
|
|
| 1024 |
*/
|
| 1025 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Iterable<A>;
|
| 1026 |
/**
|
| 1027 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 1028 |
+
* specified predicate.
|
| 1029 |
+
*
|
| 1030 |
+
* **Example** (Taking while a predicate holds)
|
| 1031 |
*
|
|
|
|
| 1032 |
* ```ts
|
| 1033 |
* import { Iterable } from "effect"
|
| 1034 |
*
|
|
|
|
| 1060 |
*/
|
| 1061 |
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Iterable<B>;
|
| 1062 |
/**
|
| 1063 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 1064 |
+
* specified predicate.
|
| 1065 |
+
*
|
| 1066 |
+
* **Example** (Taking while a predicate holds)
|
| 1067 |
*
|
|
|
|
| 1068 |
* ```ts
|
| 1069 |
* import { Iterable } from "effect"
|
| 1070 |
*
|
|
|
|
| 1097 |
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Iterable<A>;
|
| 1098 |
};
|
| 1099 |
/**
|
| 1100 |
+
* Drops a max number of elements from the start of an `Iterable`
|
| 1101 |
+
*
|
| 1102 |
+
* **Details**
|
| 1103 |
+
*
|
| 1104 |
+
* `n` is normalized to a non-negative integer.
|
| 1105 |
*
|
| 1106 |
+
* **Example** (Dropping from the start)
|
| 1107 |
*
|
|
|
|
| 1108 |
* ```ts
|
| 1109 |
* import { Iterable } from "effect"
|
| 1110 |
*
|
|
|
|
| 1130 |
*/
|
| 1131 |
export declare const drop: {
|
| 1132 |
/**
|
| 1133 |
+
* Drops a max number of elements from the start of an `Iterable`
|
| 1134 |
*
|
| 1135 |
+
* **Details**
|
| 1136 |
+
*
|
| 1137 |
+
* `n` is normalized to a non-negative integer.
|
| 1138 |
+
*
|
| 1139 |
+
* **Example** (Dropping from the start)
|
| 1140 |
*
|
|
|
|
| 1141 |
* ```ts
|
| 1142 |
* import { Iterable } from "effect"
|
| 1143 |
*
|
|
|
|
| 1163 |
*/
|
| 1164 |
(n: number): <A>(self: Iterable<A>) => Iterable<A>;
|
| 1165 |
/**
|
| 1166 |
+
* Drops a max number of elements from the start of an `Iterable`
|
| 1167 |
+
*
|
| 1168 |
+
* **Details**
|
| 1169 |
*
|
| 1170 |
+
* `n` is normalized to a non-negative integer.
|
| 1171 |
+
*
|
| 1172 |
+
* **Example** (Dropping from the start)
|
| 1173 |
*
|
|
|
|
| 1174 |
* ```ts
|
| 1175 |
* import { Iterable } from "effect"
|
| 1176 |
*
|
|
|
|
| 1200 |
* Returns the first element that satisfies the specified
|
| 1201 |
* predicate, or `None` if no such element exists.
|
| 1202 |
*
|
| 1203 |
+
* **Example** (Finding the first match)
|
| 1204 |
+
*
|
| 1205 |
* ```ts
|
| 1206 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1207 |
*
|
| 1208 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1209 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1241 |
* Returns the first element that satisfies the specified
|
| 1242 |
* predicate, or `None` if no such element exists.
|
| 1243 |
*
|
| 1244 |
+
* **Example** (Finding the first match)
|
| 1245 |
+
*
|
| 1246 |
* ```ts
|
| 1247 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1248 |
*
|
| 1249 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1250 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1282 |
* Returns the first element that satisfies the specified
|
| 1283 |
* predicate, or `None` if no such element exists.
|
| 1284 |
*
|
| 1285 |
+
* **Example** (Finding the first match)
|
| 1286 |
+
*
|
| 1287 |
* ```ts
|
| 1288 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1289 |
*
|
| 1290 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1291 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1323 |
* Returns the first element that satisfies the specified
|
| 1324 |
* predicate, or `None` if no such element exists.
|
| 1325 |
*
|
| 1326 |
+
* **Example** (Finding the first match)
|
| 1327 |
+
*
|
| 1328 |
* ```ts
|
| 1329 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1330 |
*
|
| 1331 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1332 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1364 |
* Returns the first element that satisfies the specified
|
| 1365 |
* predicate, or `None` if no such element exists.
|
| 1366 |
*
|
| 1367 |
+
* **Example** (Finding the first match)
|
| 1368 |
+
*
|
| 1369 |
* ```ts
|
| 1370 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1371 |
*
|
| 1372 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1373 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1405 |
* Returns the first element that satisfies the specified
|
| 1406 |
* predicate, or `None` if no such element exists.
|
| 1407 |
*
|
| 1408 |
+
* **Example** (Finding the first match)
|
| 1409 |
+
*
|
| 1410 |
* ```ts
|
| 1411 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1412 |
*
|
| 1413 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1414 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1446 |
* Returns the first element that satisfies the specified
|
| 1447 |
* predicate, or `None` if no such element exists.
|
| 1448 |
*
|
| 1449 |
+
* **Example** (Finding the first match)
|
| 1450 |
+
*
|
| 1451 |
* ```ts
|
| 1452 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1453 |
*
|
| 1454 |
* const numbers = [1, 3, 4, 6, 8]
|
| 1455 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 1485 |
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
|
| 1486 |
};
|
| 1487 |
/**
|
| 1488 |
+
* Finds the last element for which a predicate holds.
|
| 1489 |
+
*
|
| 1490 |
+
* **Example** (Finding the last match)
|
| 1491 |
*
|
|
|
|
| 1492 |
* ```ts
|
| 1493 |
* import { Iterable } from "effect"
|
| 1494 |
*
|
|
|
|
| 1518 |
*/
|
| 1519 |
export declare const findLast: {
|
| 1520 |
/**
|
| 1521 |
+
* Finds the last element for which a predicate holds.
|
| 1522 |
+
*
|
| 1523 |
+
* **Example** (Finding the last match)
|
| 1524 |
*
|
|
|
|
| 1525 |
* ```ts
|
| 1526 |
* import { Iterable } from "effect"
|
| 1527 |
*
|
|
|
|
| 1551 |
*/
|
| 1552 |
<A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
|
| 1553 |
/**
|
| 1554 |
+
* Finds the last element for which a predicate holds.
|
| 1555 |
+
*
|
| 1556 |
+
* **Example** (Finding the last match)
|
| 1557 |
*
|
|
|
|
| 1558 |
* ```ts
|
| 1559 |
* import { Iterable } from "effect"
|
| 1560 |
*
|
|
|
|
| 1584 |
*/
|
| 1585 |
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
|
| 1586 |
/**
|
| 1587 |
+
* Finds the last element for which a predicate holds.
|
| 1588 |
+
*
|
| 1589 |
+
* **Example** (Finding the last match)
|
| 1590 |
*
|
|
|
|
| 1591 |
* ```ts
|
| 1592 |
* import { Iterable } from "effect"
|
| 1593 |
*
|
|
|
|
| 1617 |
*/
|
| 1618 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
|
| 1619 |
/**
|
| 1620 |
+
* Finds the last element for which a predicate holds.
|
| 1621 |
+
*
|
| 1622 |
+
* **Example** (Finding the last match)
|
| 1623 |
*
|
|
|
|
| 1624 |
* ```ts
|
| 1625 |
* import { Iterable } from "effect"
|
| 1626 |
*
|
|
|
|
| 1650 |
*/
|
| 1651 |
<A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
|
| 1652 |
/**
|
| 1653 |
+
* Finds the last element for which a predicate holds.
|
| 1654 |
+
*
|
| 1655 |
+
* **Example** (Finding the last match)
|
| 1656 |
*
|
|
|
|
| 1657 |
* ```ts
|
| 1658 |
* import { Iterable } from "effect"
|
| 1659 |
*
|
|
|
|
| 1683 |
*/
|
| 1684 |
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
|
| 1685 |
/**
|
| 1686 |
+
* Finds the last element for which a predicate holds.
|
| 1687 |
+
*
|
| 1688 |
+
* **Example** (Finding the last match)
|
| 1689 |
*
|
|
|
|
| 1690 |
* ```ts
|
| 1691 |
* import { Iterable } from "effect"
|
| 1692 |
*
|
|
|
|
| 1719 |
/**
|
| 1720 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1721 |
*
|
| 1722 |
+
* **Example** (Zipping iterables)
|
| 1723 |
+
*
|
| 1724 |
* ```ts
|
| 1725 |
* import { Iterable } from "effect"
|
| 1726 |
*
|
|
|
|
| 1755 |
/**
|
| 1756 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1757 |
*
|
| 1758 |
+
* **Example** (Zipping iterables)
|
| 1759 |
+
*
|
| 1760 |
* ```ts
|
| 1761 |
* import { Iterable } from "effect"
|
| 1762 |
*
|
|
|
|
| 1791 |
/**
|
| 1792 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 1793 |
*
|
| 1794 |
+
* **Example** (Zipping iterables)
|
| 1795 |
+
*
|
| 1796 |
* ```ts
|
| 1797 |
* import { Iterable } from "effect"
|
| 1798 |
*
|
|
|
|
| 1826 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<[A, B]>;
|
| 1827 |
};
|
| 1828 |
/**
|
| 1829 |
+
* Applies a function to pairs of elements at the same index in two `Iterable`s, collecting the results. If one
|
| 1830 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1831 |
*
|
| 1832 |
+
* **Example** (Zipping with a combining function)
|
| 1833 |
+
*
|
| 1834 |
* ```ts
|
| 1835 |
* import { Iterable } from "effect"
|
| 1836 |
*
|
|
|
|
| 1874 |
*/
|
| 1875 |
export declare const zipWith: {
|
| 1876 |
/**
|
| 1877 |
+
* Applies a function to pairs of elements at the same index in two `Iterable`s, collecting the results. If one
|
| 1878 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1879 |
*
|
| 1880 |
+
* **Example** (Zipping with a combining function)
|
| 1881 |
+
*
|
| 1882 |
* ```ts
|
| 1883 |
* import { Iterable } from "effect"
|
| 1884 |
*
|
|
|
|
| 1922 |
*/
|
| 1923 |
<B, A, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Iterable<C>;
|
| 1924 |
/**
|
| 1925 |
+
* Applies a function to pairs of elements at the same index in two `Iterable`s, collecting the results. If one
|
| 1926 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 1927 |
*
|
| 1928 |
+
* **Example** (Zipping with a combining function)
|
| 1929 |
+
*
|
| 1930 |
* ```ts
|
| 1931 |
* import { Iterable } from "effect"
|
| 1932 |
*
|
|
|
|
| 1971 |
<A, B, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Iterable<C>;
|
| 1972 |
};
|
| 1973 |
/**
|
| 1974 |
+
* Places a separator between members of an `Iterable`.
|
| 1975 |
+
*
|
| 1976 |
+
* **When to use**
|
| 1977 |
+
*
|
| 1978 |
+
* Use to lazily insert a separator between adjacent values.
|
| 1979 |
+
*
|
| 1980 |
+
* **Details**
|
| 1981 |
+
*
|
| 1982 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 1983 |
*
|
| 1984 |
+
* **Example** (Interspersing separators)
|
| 1985 |
+
*
|
| 1986 |
* ```ts
|
| 1987 |
* import { Iterable } from "effect"
|
| 1988 |
*
|
|
|
|
| 2012 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 2013 |
* ```
|
| 2014 |
*
|
| 2015 |
+
* @category combining
|
| 2016 |
* @since 2.0.0
|
| 2017 |
*/
|
| 2018 |
export declare const intersperse: {
|
| 2019 |
/**
|
| 2020 |
+
* Places a separator between members of an `Iterable`.
|
| 2021 |
+
*
|
| 2022 |
+
* **When to use**
|
| 2023 |
+
*
|
| 2024 |
+
* Use to lazily insert a separator between adjacent values.
|
| 2025 |
+
*
|
| 2026 |
+
* **Details**
|
| 2027 |
+
*
|
| 2028 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 2029 |
*
|
| 2030 |
+
* **Example** (Interspersing separators)
|
| 2031 |
+
*
|
| 2032 |
* ```ts
|
| 2033 |
* import { Iterable } from "effect"
|
| 2034 |
*
|
|
|
|
| 2058 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 2059 |
* ```
|
| 2060 |
*
|
| 2061 |
+
* @category combining
|
| 2062 |
* @since 2.0.0
|
| 2063 |
*/
|
| 2064 |
<B>(middle: B): <A>(self: Iterable<A>) => Iterable<A | B>;
|
| 2065 |
/**
|
| 2066 |
+
* Places a separator between members of an `Iterable`.
|
| 2067 |
+
*
|
| 2068 |
+
* **When to use**
|
| 2069 |
+
*
|
| 2070 |
+
* Use to lazily insert a separator between adjacent values.
|
| 2071 |
+
*
|
| 2072 |
+
* **Details**
|
| 2073 |
+
*
|
| 2074 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 2075 |
*
|
| 2076 |
+
* **Example** (Interspersing separators)
|
| 2077 |
+
*
|
| 2078 |
* ```ts
|
| 2079 |
* import { Iterable } from "effect"
|
| 2080 |
*
|
|
|
|
| 2104 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 2105 |
* ```
|
| 2106 |
*
|
| 2107 |
+
* @category combining
|
| 2108 |
* @since 2.0.0
|
| 2109 |
*/
|
| 2110 |
<A, B>(self: Iterable<A>, middle: B): Iterable<A | B>;
|
|
|
|
| 2112 |
/**
|
| 2113 |
* Returns a function that checks if an `Iterable` contains a given value using a provided `isEquivalent` function.
|
| 2114 |
*
|
| 2115 |
+
* **Example** (Checking membership with custom equivalence)
|
| 2116 |
+
*
|
| 2117 |
* ```ts
|
| 2118 |
* import { Iterable } from "effect"
|
| 2119 |
*
|
|
|
|
| 2151 |
(self: Iterable<A>, a: A): boolean;
|
| 2152 |
};
|
| 2153 |
/**
|
| 2154 |
+
* Checks whether an iterable contains a value using Effect's default `Equal`
|
| 2155 |
+
* equivalence.
|
| 2156 |
+
*
|
| 2157 |
+
* **Details**
|
| 2158 |
+
*
|
| 2159 |
+
* Can be called as `contains(self, value)` or curried as
|
| 2160 |
+
* `contains(value)(self)`.
|
| 2161 |
+
*
|
| 2162 |
+
* **Example** (Checking membership)
|
| 2163 |
*
|
|
|
|
| 2164 |
* ```ts
|
| 2165 |
* import { Iterable } from "effect"
|
| 2166 |
*
|
|
|
|
| 2188 |
*/
|
| 2189 |
export declare const contains: {
|
| 2190 |
/**
|
| 2191 |
+
* Checks whether an iterable contains a value using Effect's default `Equal`
|
| 2192 |
+
* equivalence.
|
| 2193 |
+
*
|
| 2194 |
+
* **Details**
|
| 2195 |
+
*
|
| 2196 |
+
* Can be called as `contains(self, value)` or curried as
|
| 2197 |
+
* `contains(value)(self)`.
|
| 2198 |
+
*
|
| 2199 |
+
* **Example** (Checking membership)
|
| 2200 |
*
|
|
|
|
| 2201 |
* ```ts
|
| 2202 |
* import { Iterable } from "effect"
|
| 2203 |
*
|
|
|
|
| 2225 |
*/
|
| 2226 |
<A>(a: A): (self: Iterable<A>) => boolean;
|
| 2227 |
/**
|
| 2228 |
+
* Checks whether an iterable contains a value using Effect's default `Equal`
|
| 2229 |
+
* equivalence.
|
| 2230 |
+
*
|
| 2231 |
+
* **Details**
|
| 2232 |
+
*
|
| 2233 |
+
* Can be called as `contains(self, value)` or curried as
|
| 2234 |
+
* `contains(value)(self)`.
|
| 2235 |
+
*
|
| 2236 |
+
* **Example** (Checking membership)
|
| 2237 |
*
|
|
|
|
| 2238 |
* ```ts
|
| 2239 |
* import { Iterable } from "effect"
|
| 2240 |
*
|
|
|
|
| 2266 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2267 |
* the `Iterable`.
|
| 2268 |
*
|
| 2269 |
+
* **Example** (Chunking an iterable)
|
| 2270 |
+
*
|
| 2271 |
* ```ts
|
| 2272 |
* import { Iterable } from "effect"
|
| 2273 |
*
|
|
|
|
| 2306 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2307 |
* the `Iterable`.
|
| 2308 |
*
|
| 2309 |
+
* **Example** (Chunking an iterable)
|
| 2310 |
+
*
|
| 2311 |
* ```ts
|
| 2312 |
* import { Iterable } from "effect"
|
| 2313 |
*
|
|
|
|
| 2346 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 2347 |
* the `Iterable`.
|
| 2348 |
*
|
| 2349 |
+
* **Example** (Chunking an iterable)
|
| 2350 |
+
*
|
| 2351 |
* ```ts
|
| 2352 |
* import { Iterable } from "effect"
|
| 2353 |
*
|
|
|
|
| 2384 |
<A>(self: Iterable<A>, n: number): Iterable<Array<A>>;
|
| 2385 |
};
|
| 2386 |
/**
|
| 2387 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
| 2388 |
+
*
|
| 2389 |
+
* **Example** (Grouping consecutive elements with custom equivalence)
|
| 2390 |
*
|
|
|
|
| 2391 |
* ```ts
|
| 2392 |
* import { Iterable } from "effect"
|
| 2393 |
*
|
|
|
|
| 2424 |
*/
|
| 2425 |
export declare const groupWith: {
|
| 2426 |
/**
|
| 2427 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
| 2428 |
+
*
|
| 2429 |
+
* **Example** (Grouping consecutive elements with custom equivalence)
|
| 2430 |
*
|
|
|
|
| 2431 |
* ```ts
|
| 2432 |
* import { Iterable } from "effect"
|
| 2433 |
*
|
|
|
|
| 2464 |
*/
|
| 2465 |
<A>(isEquivalent: (self: A, that: A) => boolean): (self: Iterable<A>) => Iterable<NonEmptyArray<A>>;
|
| 2466 |
/**
|
| 2467 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
| 2468 |
+
*
|
| 2469 |
+
* **Example** (Grouping consecutive elements with custom equivalence)
|
| 2470 |
*
|
|
|
|
| 2471 |
* ```ts
|
| 2472 |
* import { Iterable } from "effect"
|
| 2473 |
*
|
|
|
|
| 2505 |
<A>(self: Iterable<A>, isEquivalent: (self: A, that: A) => boolean): Iterable<NonEmptyArray<A>>;
|
| 2506 |
};
|
| 2507 |
/**
|
| 2508 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s.
|
| 2509 |
+
*
|
| 2510 |
+
* **Example** (Grouping consecutive elements)
|
| 2511 |
*
|
|
|
|
| 2512 |
* ```ts
|
| 2513 |
* import { Iterable } from "effect"
|
| 2514 |
*
|
|
|
|
| 2539 |
*/
|
| 2540 |
export declare const group: <A>(self: Iterable<A>) => Iterable<NonEmptyArray<A>>;
|
| 2541 |
/**
|
| 2542 |
+
* Groups all elements by the string or symbol key returned by `f`.
|
| 2543 |
+
*
|
| 2544 |
+
* **Details**
|
| 2545 |
+
*
|
| 2546 |
+
* Each property in the returned record contains a non-empty array of elements
|
| 2547 |
+
* that produced that key. Unlike `group`, matching elements do not need to be
|
| 2548 |
+
* consecutive.
|
| 2549 |
+
*
|
| 2550 |
+
* **Example** (Grouping by a key)
|
| 2551 |
*
|
|
|
|
| 2552 |
* ```ts
|
| 2553 |
* import { Iterable } from "effect"
|
| 2554 |
*
|
|
|
|
| 2590 |
*/
|
| 2591 |
export declare const groupBy: {
|
| 2592 |
/**
|
| 2593 |
+
* Groups all elements by the string or symbol key returned by `f`.
|
| 2594 |
+
*
|
| 2595 |
+
* **Details**
|
| 2596 |
+
*
|
| 2597 |
+
* Each property in the returned record contains a non-empty array of elements
|
| 2598 |
+
* that produced that key. Unlike `group`, matching elements do not need to be
|
| 2599 |
+
* consecutive.
|
| 2600 |
+
*
|
| 2601 |
+
* **Example** (Grouping by a key)
|
| 2602 |
*
|
|
|
|
| 2603 |
* ```ts
|
| 2604 |
* import { Iterable } from "effect"
|
| 2605 |
*
|
|
|
|
| 2641 |
*/
|
| 2642 |
<A, K extends string | symbol>(f: (a: A) => K): (self: Iterable<A>) => Record<Record.ReadonlyRecord.NonLiteralKey<K>, NonEmptyArray<A>>;
|
| 2643 |
/**
|
| 2644 |
+
* Groups all elements by the string or symbol key returned by `f`.
|
| 2645 |
+
*
|
| 2646 |
+
* **Details**
|
| 2647 |
+
*
|
| 2648 |
+
* Each property in the returned record contains a non-empty array of elements
|
| 2649 |
+
* that produced that key. Unlike `group`, matching elements do not need to be
|
| 2650 |
+
* consecutive.
|
| 2651 |
+
*
|
| 2652 |
+
* **Example** (Grouping by a key)
|
| 2653 |
*
|
|
|
|
| 2654 |
* ```ts
|
| 2655 |
* import { Iterable } from "effect"
|
| 2656 |
*
|
|
|
|
| 2695 |
/**
|
| 2696 |
* Creates an empty iterable that yields no elements.
|
| 2697 |
*
|
| 2698 |
+
* **When to use**
|
| 2699 |
+
*
|
| 2700 |
+
* Use when you need an empty iterable as a typed "no data" value or a base
|
| 2701 |
+
* case for iterable operations.
|
| 2702 |
+
*
|
| 2703 |
+
* **Example** (Creating an empty iterable)
|
| 2704 |
*
|
|
|
|
| 2705 |
* ```ts
|
| 2706 |
* import { Iterable } from "effect"
|
| 2707 |
*
|
|
|
|
| 2723 |
/**
|
| 2724 |
* Creates an iterable containing a single element.
|
| 2725 |
*
|
| 2726 |
+
* **When to use**
|
|
|
|
| 2727 |
*
|
| 2728 |
+
* Use to wrap a single value in an iterable context so it can be combined
|
| 2729 |
+
* with other iterable operations.
|
| 2730 |
+
*
|
| 2731 |
+
* **Example** (Wrapping a single value)
|
| 2732 |
*
|
|
|
|
| 2733 |
* ```ts
|
| 2734 |
* import { Iterable } from "effect"
|
| 2735 |
*
|
|
|
|
| 2759 |
/**
|
| 2760 |
* Transforms each element of an iterable using a function.
|
| 2761 |
*
|
| 2762 |
+
* **Details**
|
| 2763 |
+
*
|
| 2764 |
* This is one of the most fundamental operations for working with iterables.
|
| 2765 |
* It applies a transformation function to each element, creating a new iterable
|
| 2766 |
+
* with the transformed values. The operation is lazy, so elements are only
|
| 2767 |
* transformed when the iterable is consumed.
|
| 2768 |
*
|
| 2769 |
+
* **Example** (Mapping elements)
|
|
|
|
| 2770 |
*
|
|
|
|
| 2771 |
* ```ts
|
| 2772 |
* import { Iterable } from "effect"
|
| 2773 |
*
|
|
|
|
| 2795 |
/**
|
| 2796 |
* Transforms each element of an iterable using a function.
|
| 2797 |
*
|
| 2798 |
+
* **Details**
|
| 2799 |
+
*
|
| 2800 |
* This is one of the most fundamental operations for working with iterables.
|
| 2801 |
* It applies a transformation function to each element, creating a new iterable
|
| 2802 |
+
* with the transformed values. The operation is lazy, so elements are only
|
| 2803 |
* transformed when the iterable is consumed.
|
| 2804 |
*
|
| 2805 |
+
* **Example** (Mapping elements)
|
|
|
|
| 2806 |
*
|
|
|
|
| 2807 |
* ```ts
|
| 2808 |
* import { Iterable } from "effect"
|
| 2809 |
*
|
|
|
|
| 2831 |
/**
|
| 2832 |
* Transforms each element of an iterable using a function.
|
| 2833 |
*
|
| 2834 |
+
* **Details**
|
| 2835 |
+
*
|
| 2836 |
* This is one of the most fundamental operations for working with iterables.
|
| 2837 |
* It applies a transformation function to each element, creating a new iterable
|
| 2838 |
+
* with the transformed values. The operation is lazy, so elements are only
|
| 2839 |
* transformed when the iterable is consumed.
|
| 2840 |
*
|
| 2841 |
+
* **Example** (Mapping elements)
|
|
|
|
| 2842 |
*
|
|
|
|
| 2843 |
* ```ts
|
| 2844 |
* import { Iterable } from "effect"
|
| 2845 |
*
|
|
|
|
| 2868 |
/**
|
| 2869 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2870 |
*
|
| 2871 |
+
* **Example** (FlatMapping iterables)
|
| 2872 |
+
*
|
| 2873 |
* ```ts
|
| 2874 |
* import { Iterable } from "effect"
|
| 2875 |
*
|
|
|
|
| 2907 |
/**
|
| 2908 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2909 |
*
|
| 2910 |
+
* **Example** (FlatMapping iterables)
|
| 2911 |
+
*
|
| 2912 |
* ```ts
|
| 2913 |
* import { Iterable } from "effect"
|
| 2914 |
*
|
|
|
|
| 2946 |
/**
|
| 2947 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 2948 |
*
|
| 2949 |
+
* **Example** (FlatMapping iterables)
|
| 2950 |
+
*
|
| 2951 |
* ```ts
|
| 2952 |
* import { Iterable } from "effect"
|
| 2953 |
*
|
|
|
|
| 2986 |
/**
|
| 2987 |
* Flattens an Iterable of Iterables into a single Iterable
|
| 2988 |
*
|
| 2989 |
+
* **Example** (Flattening nested iterables)
|
| 2990 |
+
*
|
| 2991 |
* ```ts
|
| 2992 |
* import { Iterable } from "effect"
|
| 2993 |
*
|
|
|
|
| 3020 |
/**
|
| 3021 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 3022 |
*
|
| 3023 |
+
* **Details**
|
| 3024 |
+
*
|
| 3025 |
+
* This combines mapping and filtering in a single operation. The function is
|
| 3026 |
+
* applied to each element, and only elements that result in `Result.succeed`
|
| 3027 |
+
* are included in the result.
|
| 3028 |
+
*
|
| 3029 |
+
* **Example** (Filtering and transforming Result values)
|
| 3030 |
*
|
|
|
|
| 3031 |
* ```ts
|
| 3032 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3033 |
*
|
| 3034 |
* // Parse strings to numbers, keeping only valid ones
|
| 3035 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
|
|
| 3069 |
/**
|
| 3070 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 3071 |
*
|
| 3072 |
+
* **Details**
|
| 3073 |
+
*
|
| 3074 |
+
* This combines mapping and filtering in a single operation. The function is
|
| 3075 |
+
* applied to each element, and only elements that result in `Result.succeed`
|
| 3076 |
+
* are included in the result.
|
| 3077 |
+
*
|
| 3078 |
+
* **Example** (Filtering and transforming Result values)
|
| 3079 |
*
|
|
|
|
| 3080 |
* ```ts
|
| 3081 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3082 |
*
|
| 3083 |
* // Parse strings to numbers, keeping only valid ones
|
| 3084 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
|
|
| 3118 |
/**
|
| 3119 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 3120 |
*
|
| 3121 |
+
* **Details**
|
| 3122 |
+
*
|
| 3123 |
+
* This combines mapping and filtering in a single operation. The function is
|
| 3124 |
+
* applied to each element, and only elements that result in `Result.succeed`
|
| 3125 |
+
* are included in the result.
|
| 3126 |
+
*
|
| 3127 |
+
* **Example** (Filtering and transforming Result values)
|
| 3128 |
*
|
|
|
|
| 3129 |
* ```ts
|
| 3130 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3131 |
*
|
| 3132 |
* // Parse strings to numbers, keeping only valid ones
|
| 3133 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
|
|
| 3168 |
/**
|
| 3169 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 3170 |
*
|
| 3171 |
+
* **Example** (Filtering and transforming until failure)
|
| 3172 |
+
*
|
| 3173 |
* ```ts
|
| 3174 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3175 |
*
|
| 3176 |
* // Parse numbers until we hit an invalid one
|
| 3177 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
|
|
| 3205 |
/**
|
| 3206 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 3207 |
*
|
| 3208 |
+
* **Example** (Filtering and transforming until failure)
|
| 3209 |
+
*
|
| 3210 |
* ```ts
|
| 3211 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3212 |
*
|
| 3213 |
* // Parse numbers until we hit an invalid one
|
| 3214 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
|
|
| 3242 |
/**
|
| 3243 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 3244 |
*
|
| 3245 |
+
* **Example** (Filtering and transforming until failure)
|
| 3246 |
+
*
|
| 3247 |
* ```ts
|
| 3248 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3249 |
*
|
| 3250 |
* // Parse numbers until we hit an invalid one
|
| 3251 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
|
|
| 3280 |
/**
|
| 3281 |
* Retrieves the `Some` values from an `Iterable` of `Option`s.
|
| 3282 |
*
|
| 3283 |
+
* **Example** (Extracting Some values)
|
| 3284 |
+
*
|
| 3285 |
* ```ts
|
| 3286 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 3287 |
* import * as assert from "node:assert"
|
| 3288 |
*
|
| 3289 |
* assert.deepStrictEqual(
|
|
|
|
| 3299 |
*/
|
| 3300 |
export declare const getSomes: <A>(self: Iterable<Option<A>>) => Iterable<A>;
|
| 3301 |
/**
|
| 3302 |
+
* Returns a lazy iterable containing the failure values from an iterable of
|
| 3303 |
+
* `Result`s, skipping successful results.
|
| 3304 |
+
*
|
| 3305 |
+
* **Example** (Extracting failures)
|
| 3306 |
*
|
|
|
|
| 3307 |
* ```ts
|
| 3308 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3309 |
* import * as assert from "node:assert"
|
| 3310 |
*
|
| 3311 |
* assert.deepStrictEqual(
|
|
|
|
| 3321 |
* ```
|
| 3322 |
*
|
| 3323 |
* @category filtering
|
| 3324 |
+
* @since 4.0.0
|
| 3325 |
*/
|
| 3326 |
export declare const getFailures: <R0, L>(self: Iterable<Result<R0, L>>) => Iterable<L>;
|
| 3327 |
/**
|
| 3328 |
+
* Returns a lazy iterable containing the success values from an iterable of
|
| 3329 |
+
* `Result`s, skipping failed results.
|
| 3330 |
+
*
|
| 3331 |
+
* **Example** (Extracting successes)
|
| 3332 |
*
|
|
|
|
| 3333 |
* ```ts
|
| 3334 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 3335 |
* import * as assert from "node:assert"
|
| 3336 |
*
|
| 3337 |
* assert.deepStrictEqual(
|
|
|
|
| 3347 |
* ```
|
| 3348 |
*
|
| 3349 |
* @category filtering
|
| 3350 |
+
* @since 4.0.0
|
| 3351 |
*/
|
| 3352 |
export declare const getSuccesses: <R0, L>(self: Iterable<Result<R0, L>>) => Iterable<R0>;
|
| 3353 |
/**
|
| 3354 |
* Filters an iterable to only include elements that match a predicate.
|
| 3355 |
*
|
| 3356 |
+
* **Details**
|
| 3357 |
+
*
|
| 3358 |
* This function creates a new iterable containing only the elements for which
|
| 3359 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3360 |
* elements are only tested when the iterable is consumed.
|
| 3361 |
*
|
| 3362 |
+
* **Example** (Filtering elements)
|
|
|
|
| 3363 |
*
|
|
|
|
| 3364 |
* ```ts
|
| 3365 |
* import { Iterable } from "effect"
|
| 3366 |
*
|
|
|
|
| 3397 |
/**
|
| 3398 |
* Filters an iterable to only include elements that match a predicate.
|
| 3399 |
*
|
| 3400 |
+
* **Details**
|
| 3401 |
+
*
|
| 3402 |
* This function creates a new iterable containing only the elements for which
|
| 3403 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3404 |
* elements are only tested when the iterable is consumed.
|
| 3405 |
*
|
| 3406 |
+
* **Example** (Filtering elements)
|
|
|
|
| 3407 |
*
|
|
|
|
| 3408 |
* ```ts
|
| 3409 |
* import { Iterable } from "effect"
|
| 3410 |
*
|
|
|
|
| 3441 |
/**
|
| 3442 |
* Filters an iterable to only include elements that match a predicate.
|
| 3443 |
*
|
| 3444 |
+
* **Details**
|
| 3445 |
+
*
|
| 3446 |
* This function creates a new iterable containing only the elements for which
|
| 3447 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3448 |
* elements are only tested when the iterable is consumed.
|
| 3449 |
*
|
| 3450 |
+
* **Example** (Filtering elements)
|
|
|
|
| 3451 |
*
|
|
|
|
| 3452 |
* ```ts
|
| 3453 |
* import { Iterable } from "effect"
|
| 3454 |
*
|
|
|
|
| 3485 |
/**
|
| 3486 |
* Filters an iterable to only include elements that match a predicate.
|
| 3487 |
*
|
| 3488 |
+
* **Details**
|
| 3489 |
+
*
|
| 3490 |
* This function creates a new iterable containing only the elements for which
|
| 3491 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3492 |
* elements are only tested when the iterable is consumed.
|
| 3493 |
*
|
| 3494 |
+
* **Example** (Filtering elements)
|
|
|
|
| 3495 |
*
|
|
|
|
| 3496 |
* ```ts
|
| 3497 |
* import { Iterable } from "effect"
|
| 3498 |
*
|
|
|
|
| 3529 |
/**
|
| 3530 |
* Filters an iterable to only include elements that match a predicate.
|
| 3531 |
*
|
| 3532 |
+
* **Details**
|
| 3533 |
+
*
|
| 3534 |
* This function creates a new iterable containing only the elements for which
|
| 3535 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 3536 |
* elements are only tested when the iterable is consumed.
|
| 3537 |
*
|
| 3538 |
+
* **Example** (Filtering elements)
|
|
|
|
| 3539 |
*
|
|
|
|
| 3540 |
* ```ts
|
| 3541 |
* import { Iterable } from "effect"
|
| 3542 |
*
|
|
|
|
| 3574 |
/**
|
| 3575 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3576 |
*
|
| 3577 |
+
* **When to use**
|
| 3578 |
+
*
|
| 3579 |
+
* Use when working with APIs or functions that return nullable values,
|
| 3580 |
+
* providing a clean way to filter out null or undefined while transforming.
|
| 3581 |
+
*
|
| 3582 |
+
* **Example** (FlatMapping nullable results)
|
| 3583 |
*
|
|
|
|
| 3584 |
* ```ts
|
| 3585 |
* import { Iterable } from "effect"
|
| 3586 |
*
|
|
|
|
| 3614 |
* ```
|
| 3615 |
*
|
| 3616 |
* @category sequencing
|
| 3617 |
+
* @since 4.0.0
|
| 3618 |
*/
|
| 3619 |
export declare const flatMapNullishOr: {
|
| 3620 |
/**
|
| 3621 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3622 |
*
|
| 3623 |
+
* **When to use**
|
| 3624 |
+
*
|
| 3625 |
+
* Use when working with APIs or functions that return nullable values,
|
| 3626 |
+
* providing a clean way to filter out null or undefined while transforming.
|
| 3627 |
+
*
|
| 3628 |
+
* **Example** (FlatMapping nullable results)
|
| 3629 |
*
|
|
|
|
| 3630 |
* ```ts
|
| 3631 |
* import { Iterable } from "effect"
|
| 3632 |
*
|
|
|
|
| 3660 |
* ```
|
| 3661 |
*
|
| 3662 |
* @category sequencing
|
| 3663 |
+
* @since 4.0.0
|
| 3664 |
*/
|
| 3665 |
<A, B>(f: (a: A) => B): (self: Iterable<A>) => Iterable<NonNullable<B>>;
|
| 3666 |
/**
|
| 3667 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 3668 |
*
|
| 3669 |
+
* **When to use**
|
| 3670 |
+
*
|
| 3671 |
+
* Use when working with APIs or functions that return nullable values,
|
| 3672 |
+
* providing a clean way to filter out null or undefined while transforming.
|
| 3673 |
+
*
|
| 3674 |
+
* **Example** (FlatMapping nullable results)
|
| 3675 |
*
|
|
|
|
| 3676 |
* ```ts
|
| 3677 |
* import { Iterable } from "effect"
|
| 3678 |
*
|
|
|
|
| 3706 |
* ```
|
| 3707 |
*
|
| 3708 |
* @category sequencing
|
| 3709 |
+
* @since 4.0.0
|
| 3710 |
*/
|
| 3711 |
<A, B>(self: Iterable<A>, f: (a: A) => B): Iterable<NonNullable<B>>;
|
| 3712 |
};
|
| 3713 |
/**
|
| 3714 |
+
* Checks whether a predicate holds true for some `Iterable` element.
|
| 3715 |
+
*
|
| 3716 |
+
* **Example** (Checking whether some element matches)
|
| 3717 |
*
|
|
|
|
| 3718 |
* ```ts
|
| 3719 |
* import { Iterable } from "effect"
|
| 3720 |
*
|
|
|
|
| 3753 |
*/
|
| 3754 |
export declare const some: {
|
| 3755 |
/**
|
| 3756 |
+
* Checks whether a predicate holds true for some `Iterable` element.
|
| 3757 |
+
*
|
| 3758 |
+
* **Example** (Checking whether some element matches)
|
| 3759 |
*
|
|
|
|
| 3760 |
* ```ts
|
| 3761 |
* import { Iterable } from "effect"
|
| 3762 |
*
|
|
|
|
| 3795 |
*/
|
| 3796 |
<A>(predicate: (a: A, i: number) => boolean): (self: Iterable<A>) => boolean;
|
| 3797 |
/**
|
| 3798 |
+
* Checks whether a predicate holds true for some `Iterable` element.
|
| 3799 |
+
*
|
| 3800 |
+
* **Example** (Checking whether some element matches)
|
| 3801 |
*
|
|
|
|
| 3802 |
* ```ts
|
| 3803 |
* import { Iterable } from "effect"
|
| 3804 |
*
|
|
|
|
| 3841 |
* Generates an iterable by repeatedly applying a function that produces the
|
| 3842 |
* next element and state.
|
| 3843 |
*
|
| 3844 |
+
* **Details**
|
| 3845 |
+
*
|
| 3846 |
* This is useful for creating iterables from a generating function that
|
| 3847 |
* maintains state. The function should return `Option.some([value, nextState])`
|
| 3848 |
* to continue or `Option.none()` to stop.
|
| 3849 |
*
|
| 3850 |
+
* **Example** (Unfolding state into values)
|
| 3851 |
+
*
|
| 3852 |
* ```ts
|
| 3853 |
* import { Iterable, Option } from "effect"
|
| 3854 |
*
|
|
|
|
| 3879 |
*/
|
| 3880 |
export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>) => Iterable<A>;
|
| 3881 |
/**
|
| 3882 |
+
* Iterates over the `Iterable`, applying `f` to each element.
|
| 3883 |
+
*
|
| 3884 |
+
* **Example** (Iterating with side effects)
|
| 3885 |
*
|
|
|
|
| 3886 |
* ```ts
|
| 3887 |
* import { Iterable } from "effect"
|
| 3888 |
*
|
|
|
|
| 3918 |
*/
|
| 3919 |
export declare const forEach: {
|
| 3920 |
/**
|
| 3921 |
+
* Iterates over the `Iterable`, applying `f` to each element.
|
| 3922 |
+
*
|
| 3923 |
+
* **Example** (Iterating with side effects)
|
| 3924 |
*
|
|
|
|
| 3925 |
* ```ts
|
| 3926 |
* import { Iterable } from "effect"
|
| 3927 |
*
|
|
|
|
| 3957 |
*/
|
| 3958 |
<A>(f: (a: A, i: number) => void): (self: Iterable<A>) => void;
|
| 3959 |
/**
|
| 3960 |
+
* Iterates over the `Iterable`, applying `f` to each element.
|
| 3961 |
+
*
|
| 3962 |
+
* **Example** (Iterating with side effects)
|
| 3963 |
*
|
|
|
|
| 3964 |
* ```ts
|
| 3965 |
* import { Iterable } from "effect"
|
| 3966 |
*
|
|
|
|
| 3997 |
<A>(self: Iterable<A>, f: (a: A, i: number) => void): void;
|
| 3998 |
};
|
| 3999 |
/**
|
| 4000 |
+
* Reduces an iterable to a single value by applying a function to each element and accumulating the result.
|
| 4001 |
+
*
|
| 4002 |
+
* **Details**
|
| 4003 |
*
|
| 4004 |
* This function applies a reducing function against an accumulator and each element
|
| 4005 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 4006 |
*
|
| 4007 |
+
* **Example** (Reducing an iterable)
|
| 4008 |
+
*
|
| 4009 |
* ```ts
|
| 4010 |
* import { Iterable } from "effect"
|
| 4011 |
*
|
|
|
|
| 4049 |
*/
|
| 4050 |
export declare const reduce: {
|
| 4051 |
/**
|
| 4052 |
+
* Reduces an iterable to a single value by applying a function to each element and accumulating the result.
|
| 4053 |
+
*
|
| 4054 |
+
* **Details**
|
| 4055 |
*
|
| 4056 |
* This function applies a reducing function against an accumulator and each element
|
| 4057 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 4058 |
*
|
| 4059 |
+
* **Example** (Reducing an iterable)
|
| 4060 |
+
*
|
| 4061 |
* ```ts
|
| 4062 |
* import { Iterable } from "effect"
|
| 4063 |
*
|
|
|
|
| 4101 |
*/
|
| 4102 |
<B, A>(b: B, f: (b: B, a: A, i: number) => B): (self: Iterable<A>) => B;
|
| 4103 |
/**
|
| 4104 |
+
* Reduces an iterable to a single value by applying a function to each element and accumulating the result.
|
| 4105 |
+
*
|
| 4106 |
+
* **Details**
|
| 4107 |
*
|
| 4108 |
* This function applies a reducing function against an accumulator and each element
|
| 4109 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 4110 |
*
|
| 4111 |
+
* **Example** (Reducing an iterable)
|
| 4112 |
+
*
|
| 4113 |
* ```ts
|
| 4114 |
* import { Iterable } from "effect"
|
| 4115 |
*
|
|
|
|
| 4156 |
/**
|
| 4157 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 4158 |
*
|
| 4159 |
+
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
| 4160 |
+
*
|
| 4161 |
* ```ts
|
| 4162 |
* import { Iterable } from "effect"
|
| 4163 |
*
|
|
|
|
| 4199 |
/**
|
| 4200 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 4201 |
*
|
| 4202 |
+
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
| 4203 |
+
*
|
| 4204 |
* ```ts
|
| 4205 |
* import { Iterable } from "effect"
|
| 4206 |
*
|
|
|
|
| 4242 |
/**
|
| 4243 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 4244 |
*
|
| 4245 |
+
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
| 4246 |
+
*
|
| 4247 |
* ```ts
|
| 4248 |
* import { Iterable } from "effect"
|
| 4249 |
*
|
|
|
|
| 4286 |
/**
|
| 4287 |
* Deduplicates adjacent elements that are identical.
|
| 4288 |
*
|
| 4289 |
+
* **Example** (Deduplicating adjacent elements)
|
| 4290 |
+
*
|
| 4291 |
* ```ts
|
| 4292 |
* import { Iterable } from "effect"
|
| 4293 |
*
|
|
|
|
| 4325 |
/**
|
| 4326 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 4327 |
*
|
| 4328 |
+
* **Example** (Combining cartesian products)
|
| 4329 |
+
*
|
| 4330 |
* ```ts
|
| 4331 |
* import { Iterable } from "effect"
|
| 4332 |
*
|
|
|
|
| 4369 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4370 |
* ```
|
| 4371 |
*
|
|
|
|
| 4372 |
* @category elements
|
| 4373 |
+
* @since 2.0.0
|
| 4374 |
*/
|
| 4375 |
export declare const cartesianWith: {
|
| 4376 |
/**
|
| 4377 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 4378 |
*
|
| 4379 |
+
* **Example** (Combining cartesian products)
|
| 4380 |
+
*
|
| 4381 |
* ```ts
|
| 4382 |
* import { Iterable } from "effect"
|
| 4383 |
*
|
|
|
|
| 4420 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4421 |
* ```
|
| 4422 |
*
|
|
|
|
| 4423 |
* @category elements
|
| 4424 |
+
* @since 2.0.0
|
| 4425 |
*/
|
| 4426 |
<A, B, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Iterable<C>;
|
| 4427 |
/**
|
| 4428 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 4429 |
*
|
| 4430 |
+
* **Example** (Combining cartesian products)
|
| 4431 |
+
*
|
| 4432 |
* ```ts
|
| 4433 |
* import { Iterable } from "effect"
|
| 4434 |
*
|
|
|
|
| 4471 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 4472 |
* ```
|
| 4473 |
*
|
|
|
|
| 4474 |
* @category elements
|
| 4475 |
+
* @since 2.0.0
|
| 4476 |
*/
|
| 4477 |
<A, B, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Iterable<C>;
|
| 4478 |
};
|
| 4479 |
/**
|
| 4480 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4481 |
*
|
| 4482 |
+
* **Example** (Generating cartesian pairs)
|
| 4483 |
+
*
|
| 4484 |
* ```ts
|
| 4485 |
* import { Iterable } from "effect"
|
| 4486 |
*
|
|
|
|
| 4514 |
* console.log(Array.from(withEmpty)) // []
|
| 4515 |
* ```
|
| 4516 |
*
|
|
|
|
| 4517 |
* @category elements
|
| 4518 |
+
* @since 2.0.0
|
| 4519 |
*/
|
| 4520 |
export declare const cartesian: {
|
| 4521 |
/**
|
| 4522 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4523 |
*
|
| 4524 |
+
* **Example** (Generating cartesian pairs)
|
| 4525 |
+
*
|
| 4526 |
* ```ts
|
| 4527 |
* import { Iterable } from "effect"
|
| 4528 |
*
|
|
|
|
| 4556 |
* console.log(Array.from(withEmpty)) // []
|
| 4557 |
* ```
|
| 4558 |
*
|
|
|
|
| 4559 |
* @category elements
|
| 4560 |
+
* @since 2.0.0
|
| 4561 |
*/
|
| 4562 |
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<[A, B]>;
|
| 4563 |
/**
|
| 4564 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 4565 |
*
|
| 4566 |
+
* **Example** (Generating cartesian pairs)
|
| 4567 |
+
*
|
| 4568 |
* ```ts
|
| 4569 |
* import { Iterable } from "effect"
|
| 4570 |
*
|
|
|
|
| 4598 |
* console.log(Array.from(withEmpty)) // []
|
| 4599 |
* ```
|
| 4600 |
*
|
|
|
|
| 4601 |
* @category elements
|
| 4602 |
+
* @since 2.0.0
|
| 4603 |
*/
|
| 4604 |
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<[A, B]>;
|
| 4605 |
};
|
| 4606 |
/**
|
| 4607 |
+
* Computes how many elements of the iterable pass the given predicate.
|
| 4608 |
*
|
| 4609 |
+
* **Example** (Counting matching elements)
|
| 4610 |
*
|
| 4611 |
* ```ts
|
| 4612 |
* import { Iterable } from "effect"
|
|
|
|
| 4620 |
*/
|
| 4621 |
export declare const countBy: {
|
| 4622 |
/**
|
| 4623 |
+
* Computes how many elements of the iterable pass the given predicate.
|
| 4624 |
*
|
| 4625 |
+
* **Example** (Counting matching elements)
|
| 4626 |
*
|
| 4627 |
* ```ts
|
| 4628 |
* import { Iterable } from "effect"
|
|
|
|
| 4636 |
*/
|
| 4637 |
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => number;
|
| 4638 |
/**
|
| 4639 |
+
* Computes how many elements of the iterable pass the given predicate.
|
| 4640 |
*
|
| 4641 |
+
* **Example** (Counting matching elements)
|
| 4642 |
*
|
| 4643 |
* ```ts
|
| 4644 |
* import { Iterable } from "effect"
|
.opencode/node_modules/effect/dist/Iterable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Iterable.d.ts","sourceRoot":"","sources":["../src/Iterable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,OAAO,KAAK,KAAK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SAAS,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;IACpF;;;;;;;;;;;;;;OAcG;IACH,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAAA;CAiBxE,CAAA"}
|
.opencode/node_modules/effect/dist/Iterable.js
CHANGED
|
@@ -1,31 +1,10 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
*
|
| 4 |
-
* Iterables
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* Unlike arrays, iterables can be lazy and potentially infinite, making them suitable
|
| 10 |
-
* for stream processing and memory-efficient data manipulation. All functions in this
|
| 11 |
-
* module preserve the lazy nature of iterables where possible.
|
| 12 |
-
*
|
| 13 |
-
* @example
|
| 14 |
-
* ```ts
|
| 15 |
-
* import { Iterable, Option } from "effect"
|
| 16 |
-
*
|
| 17 |
-
* // Create iterables
|
| 18 |
-
* const numbers = Iterable.range(1, 5)
|
| 19 |
-
* const doubled = Iterable.map(numbers, (x) => x * 2)
|
| 20 |
-
* const filtered = Iterable.filter(doubled, (x) => x > 5)
|
| 21 |
-
*
|
| 22 |
-
* console.log(Array.from(filtered)) // [6, 8, 10]
|
| 23 |
-
*
|
| 24 |
-
* // Infinite iterables
|
| 25 |
-
* const fibonacci = Iterable.unfold([0, 1], ([a, b]) => Option.some([a, [b, a + b]]))
|
| 26 |
-
* const first10 = Iterable.take(fibonacci, 10)
|
| 27 |
-
* console.log(Array.from(first10)) // [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
| 28 |
-
* ```
|
| 29 |
*
|
| 30 |
* @since 2.0.0
|
| 31 |
*/
|
|
@@ -38,14 +17,14 @@ import * as Tuple from "./Tuple.js";
|
|
| 38 |
/**
|
| 39 |
* Creates an iterable by applying a function to consecutive integers.
|
| 40 |
*
|
| 41 |
-
*
|
| 42 |
-
*
|
| 43 |
-
*
|
|
|
|
|
|
|
| 44 |
*
|
| 45 |
-
*
|
| 46 |
-
* @param options - Configuration object with optional length
|
| 47 |
*
|
| 48 |
-
* @example
|
| 49 |
* ```ts
|
| 50 |
* import { Iterable } from "effect"
|
| 51 |
*
|
|
@@ -89,16 +68,21 @@ export const makeBy = (f, options) => {
|
|
| 89 |
};
|
| 90 |
};
|
| 91 |
/**
|
| 92 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
*
|
| 94 |
-
*
|
| 95 |
*
|
| 96 |
-
* @example
|
| 97 |
* ```ts
|
| 98 |
-
* import {
|
| 99 |
* import * as assert from "node:assert"
|
| 100 |
*
|
| 101 |
-
* assert.deepStrictEqual(Array.from(range(1, 3)), [1, 2, 3])
|
| 102 |
* ```
|
| 103 |
*
|
| 104 |
* @category constructors
|
|
@@ -113,16 +97,19 @@ export const range = (start, end) => {
|
|
| 113 |
});
|
| 114 |
};
|
| 115 |
/**
|
| 116 |
-
*
|
|
|
|
|
|
|
| 117 |
*
|
| 118 |
-
*
|
|
|
|
|
|
|
| 119 |
*
|
| 120 |
-
* @example
|
| 121 |
* ```ts
|
| 122 |
-
* import {
|
| 123 |
* import * as assert from "node:assert"
|
| 124 |
*
|
| 125 |
-
* assert.deepStrictEqual(Array.from(replicate("a", 3)), ["a", "a", "a"])
|
| 126 |
* ```
|
| 127 |
*
|
| 128 |
* @category constructors
|
|
@@ -132,6 +119,19 @@ export const replicate = /*#__PURE__*/dual(2, (a, n) => makeBy(() => a, {
|
|
| 132 |
length: n
|
| 133 |
}));
|
| 134 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
* @category constructors
|
| 136 |
* @since 4.0.0
|
| 137 |
*/
|
|
@@ -139,6 +139,21 @@ export const repeat = /*#__PURE__*/dual(2, (self, n) => flatten(makeBy(() => sel
|
|
| 139 |
length: n
|
| 140 |
})));
|
| 141 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
* @category constructors
|
| 143 |
* @since 4.0.0
|
| 144 |
*/
|
|
@@ -146,19 +161,20 @@ export const forever = self => repeat(self, Infinity);
|
|
| 146 |
/**
|
| 147 |
* Takes a record and returns an Iterable of tuples containing its keys and values.
|
| 148 |
*
|
| 149 |
-
*
|
|
|
|
| 150 |
* ```ts
|
| 151 |
-
* import {
|
| 152 |
* import * as assert from "node:assert"
|
| 153 |
*
|
| 154 |
* const x = { a: 1, b: 2, c: 3 }
|
| 155 |
-
* assert.deepStrictEqual(Array.from(fromRecord(x)), [["a", 1], ["b", 2], [
|
| 156 |
* "c",
|
| 157 |
* 3
|
| 158 |
* ]])
|
| 159 |
* ```
|
| 160 |
*
|
| 161 |
-
* @category
|
| 162 |
* @since 2.0.0
|
| 163 |
*/
|
| 164 |
export const fromRecord = self => ({
|
|
@@ -171,9 +187,10 @@ export const fromRecord = self => ({
|
|
| 171 |
}
|
| 172 |
});
|
| 173 |
/**
|
| 174 |
-
*
|
|
|
|
|
|
|
| 175 |
*
|
| 176 |
-
* @example
|
| 177 |
* ```ts
|
| 178 |
* import { Iterable } from "effect"
|
| 179 |
*
|
|
@@ -187,14 +204,15 @@ export const fromRecord = self => ({
|
|
| 187 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 188 |
* ```
|
| 189 |
*
|
| 190 |
-
* @category
|
| 191 |
* @since 2.0.0
|
| 192 |
*/
|
| 193 |
export const prepend = /*#__PURE__*/dual(2, (self, head) => prependAll(self, [head]));
|
| 194 |
/**
|
| 195 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 196 |
*
|
| 197 |
-
*
|
|
|
|
| 198 |
* ```ts
|
| 199 |
* import { Iterable } from "effect"
|
| 200 |
* import * as assert from "node:assert"
|
|
@@ -205,14 +223,30 @@ export const prepend = /*#__PURE__*/dual(2, (self, head) => prependAll(self, [he
|
|
| 205 |
* )
|
| 206 |
* ```
|
| 207 |
*
|
| 208 |
-
* @category
|
| 209 |
* @since 2.0.0
|
| 210 |
*/
|
| 211 |
export const prependAll = /*#__PURE__*/dual(2, (self, that) => appendAll(that, self));
|
| 212 |
/**
|
| 213 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
*
|
| 215 |
-
* @example
|
| 216 |
* ```ts
|
| 217 |
* import { Iterable } from "effect"
|
| 218 |
*
|
|
@@ -228,14 +262,32 @@ export const prependAll = /*#__PURE__*/dual(2, (self, that) => appendAll(that, s
|
|
| 228 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 229 |
* ```
|
| 230 |
*
|
| 231 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 232 |
* @since 2.0.0
|
| 233 |
*/
|
| 234 |
export const append = /*#__PURE__*/dual(2, (self, last) => appendAll(self, [last]));
|
| 235 |
/**
|
| 236 |
* Concatenates two iterables, combining their elements.
|
| 237 |
*
|
| 238 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
* ```ts
|
| 240 |
* import { Iterable } from "effect"
|
| 241 |
*
|
|
@@ -257,7 +309,10 @@ export const append = /*#__PURE__*/dual(2, (self, last) => appendAll(self, [last
|
|
| 257 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 258 |
* ```
|
| 259 |
*
|
| 260 |
-
* @
|
|
|
|
|
|
|
|
|
|
| 261 |
* @since 2.0.0
|
| 262 |
*/
|
| 263 |
export const appendAll = /*#__PURE__*/dual(2, (self, that) => ({
|
|
@@ -282,9 +337,10 @@ export const appendAll = /*#__PURE__*/dual(2, (self, that) => ({
|
|
| 282 |
}
|
| 283 |
}));
|
| 284 |
/**
|
| 285 |
-
*
|
|
|
|
|
|
|
| 286 |
*
|
| 287 |
-
* @example
|
| 288 |
* ```ts
|
| 289 |
* import { Iterable } from "effect"
|
| 290 |
*
|
|
@@ -335,15 +391,16 @@ export const scan = /*#__PURE__*/dual(3, (self, b, f) => ({
|
|
| 335 |
}
|
| 336 |
}));
|
| 337 |
/**
|
| 338 |
-
*
|
|
|
|
|
|
|
| 339 |
*
|
| 340 |
-
* @example
|
| 341 |
* ```ts
|
| 342 |
-
* import {
|
| 343 |
* import * as assert from "node:assert"
|
| 344 |
*
|
| 345 |
-
* assert.deepStrictEqual(isEmpty([]), true)
|
| 346 |
-
* assert.deepStrictEqual(isEmpty([1, 2, 3]), false)
|
| 347 |
* ```
|
| 348 |
*
|
| 349 |
* @category guards
|
|
@@ -354,9 +411,10 @@ export const isEmpty = self => {
|
|
| 354 |
return iterator.next().done === true;
|
| 355 |
};
|
| 356 |
/**
|
| 357 |
-
*
|
|
|
|
|
|
|
| 358 |
*
|
| 359 |
-
* @example
|
| 360 |
* ```ts
|
| 361 |
* import { Iterable } from "effect"
|
| 362 |
*
|
|
@@ -387,12 +445,12 @@ export const size = self => {
|
|
| 387 |
return count;
|
| 388 |
};
|
| 389 |
/**
|
| 390 |
-
*
|
|
|
|
|
|
|
| 391 |
*
|
| 392 |
-
* @example
|
| 393 |
* ```ts
|
| 394 |
-
* import { Iterable } from "effect"
|
| 395 |
-
* import * as Option from "effect/Option"
|
| 396 |
*
|
| 397 |
* const numbers = [1, 2, 3]
|
| 398 |
* console.log(Iterable.head(numbers)) // Option.some(1)
|
|
@@ -420,9 +478,19 @@ export const head = self => {
|
|
| 420 |
return result.done ? O.none() : O.some(result.value);
|
| 421 |
};
|
| 422 |
/**
|
| 423 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
*
|
| 425 |
-
* @example
|
| 426 |
* ```ts
|
| 427 |
* import { Iterable } from "effect"
|
| 428 |
*
|
|
@@ -432,13 +500,8 @@ export const head = self => {
|
|
| 432 |
* const letters = "hello"
|
| 433 |
* console.log(Iterable.headUnsafe(letters)) // "h"
|
| 434 |
*
|
| 435 |
-
* //
|
| 436 |
-
*
|
| 437 |
-
* const empty = Iterable.empty<number>()
|
| 438 |
-
* Iterable.headUnsafe(empty) // throws Error: "headUnsafe: empty iterable"
|
| 439 |
-
* } catch (error) {
|
| 440 |
-
* console.log((error as Error).message) // "headUnsafe: empty iterable"
|
| 441 |
-
* }
|
| 442 |
*
|
| 443 |
* // Use only when you're certain the iterable is non-empty
|
| 444 |
* const nonEmpty = Iterable.range(1, 10)
|
|
@@ -446,7 +509,7 @@ export const head = self => {
|
|
| 446 |
* ```
|
| 447 |
*
|
| 448 |
* @category getters
|
| 449 |
-
* @since
|
| 450 |
*/
|
| 451 |
export const headUnsafe = self => {
|
| 452 |
const iterator = self[Symbol.iterator]();
|
|
@@ -455,11 +518,14 @@ export const headUnsafe = self => {
|
|
| 455 |
return result.value;
|
| 456 |
};
|
| 457 |
/**
|
| 458 |
-
*
|
| 459 |
*
|
| 460 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
*
|
| 462 |
-
* @example
|
| 463 |
* ```ts
|
| 464 |
* import { Iterable } from "effect"
|
| 465 |
*
|
|
@@ -503,9 +569,11 @@ export const take = /*#__PURE__*/dual(2, (self, n) => ({
|
|
| 503 |
}
|
| 504 |
}));
|
| 505 |
/**
|
| 506 |
-
*
|
|
|
|
|
|
|
|
|
|
| 507 |
*
|
| 508 |
-
* @example
|
| 509 |
* ```ts
|
| 510 |
* import { Iterable } from "effect"
|
| 511 |
*
|
|
@@ -554,11 +622,14 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
| 554 |
}
|
| 555 |
}));
|
| 556 |
/**
|
| 557 |
-
*
|
|
|
|
|
|
|
| 558 |
*
|
| 559 |
-
*
|
|
|
|
|
|
|
| 560 |
*
|
| 561 |
-
* @example
|
| 562 |
* ```ts
|
| 563 |
* import { Iterable } from "effect"
|
| 564 |
*
|
|
@@ -607,10 +678,10 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => ({
|
|
| 607 |
* Returns the first element that satisfies the specified
|
| 608 |
* predicate, or `None` if no such element exists.
|
| 609 |
*
|
| 610 |
-
*
|
|
|
|
| 611 |
* ```ts
|
| 612 |
-
* import { Iterable } from "effect"
|
| 613 |
-
* import * as Option from "effect/Option"
|
| 614 |
*
|
| 615 |
* const numbers = [1, 3, 4, 6, 8]
|
| 616 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
@@ -661,9 +732,10 @@ export const findFirst = /*#__PURE__*/dual(2, (self, f) => {
|
|
| 661 |
return O.none();
|
| 662 |
});
|
| 663 |
/**
|
| 664 |
-
*
|
|
|
|
|
|
|
| 665 |
*
|
| 666 |
-
* @example
|
| 667 |
* ```ts
|
| 668 |
* import { Iterable } from "effect"
|
| 669 |
*
|
|
@@ -712,7 +784,8 @@ export const findLast = /*#__PURE__*/dual(2, (self, f) => {
|
|
| 712 |
/**
|
| 713 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 714 |
*
|
| 715 |
-
*
|
|
|
|
| 716 |
* ```ts
|
| 717 |
* import { Iterable } from "effect"
|
| 718 |
*
|
|
@@ -745,10 +818,11 @@ export const findLast = /*#__PURE__*/dual(2, (self, f) => {
|
|
| 745 |
*/
|
| 746 |
export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tuple.make));
|
| 747 |
/**
|
| 748 |
-
*
|
| 749 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 750 |
*
|
| 751 |
-
*
|
|
|
|
| 752 |
* ```ts
|
| 753 |
* import { Iterable } from "effect"
|
| 754 |
*
|
|
@@ -813,10 +887,18 @@ export const zipWith = /*#__PURE__*/dual(3, (self, that, f) => ({
|
|
| 813 |
}
|
| 814 |
}));
|
| 815 |
/**
|
| 816 |
-
* Places
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 818 |
*
|
| 819 |
-
*
|
|
|
|
| 820 |
* ```ts
|
| 821 |
* import { Iterable } from "effect"
|
| 822 |
*
|
|
@@ -846,7 +928,7 @@ export const zipWith = /*#__PURE__*/dual(3, (self, that, f) => ({
|
|
| 846 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 847 |
* ```
|
| 848 |
*
|
| 849 |
-
* @category
|
| 850 |
* @since 2.0.0
|
| 851 |
*/
|
| 852 |
export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
@@ -876,7 +958,8 @@ export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
| 876 |
/**
|
| 877 |
* Returns a function that checks if an `Iterable` contains a given value using a provided `isEquivalent` function.
|
| 878 |
*
|
| 879 |
-
*
|
|
|
|
| 880 |
* ```ts
|
| 881 |
* import { Iterable } from "effect"
|
| 882 |
*
|
|
@@ -918,9 +1001,16 @@ export const containsWith = isEquivalent => dual(2, (self, a) => {
|
|
| 918 |
return false;
|
| 919 |
});
|
| 920 |
/**
|
| 921 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 922 |
*
|
| 923 |
-
* @example
|
| 924 |
* ```ts
|
| 925 |
* import { Iterable } from "effect"
|
| 926 |
*
|
|
@@ -951,7 +1041,8 @@ export const contains = /*#__PURE__*/containsWith(/*#__PURE__*/Equal.asEquivalen
|
|
| 951 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 952 |
* the `Iterable`.
|
| 953 |
*
|
| 954 |
-
*
|
|
|
|
| 955 |
* ```ts
|
| 956 |
* import { Iterable } from "effect"
|
| 957 |
*
|
|
@@ -1023,9 +1114,10 @@ export const chunksOf = /*#__PURE__*/dual(2, (self, n) => {
|
|
| 1023 |
};
|
| 1024 |
});
|
| 1025 |
/**
|
| 1026 |
-
*
|
|
|
|
|
|
|
| 1027 |
*
|
| 1028 |
-
* @example
|
| 1029 |
* ```ts
|
| 1030 |
* import { Iterable } from "effect"
|
| 1031 |
*
|
|
@@ -1102,9 +1194,10 @@ export const groupWith = /*#__PURE__*/dual(2, (self, isEquivalent) => ({
|
|
| 1102 |
}
|
| 1103 |
}));
|
| 1104 |
/**
|
| 1105 |
-
*
|
|
|
|
|
|
|
| 1106 |
*
|
| 1107 |
-
* @example
|
| 1108 |
* ```ts
|
| 1109 |
* import { Iterable } from "effect"
|
| 1110 |
*
|
|
@@ -1135,10 +1228,16 @@ export const groupWith = /*#__PURE__*/dual(2, (self, isEquivalent) => ({
|
|
| 1135 |
*/
|
| 1136 |
export const group = /*#__PURE__*/groupWith(/*#__PURE__*/Equal.asEquivalence());
|
| 1137 |
/**
|
| 1138 |
-
*
|
| 1139 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1140 |
*
|
| 1141 |
-
* @example
|
| 1142 |
* ```ts
|
| 1143 |
* import { Iterable } from "effect"
|
| 1144 |
*
|
|
@@ -1206,10 +1305,13 @@ const constEmptyIterator = {
|
|
| 1206 |
/**
|
| 1207 |
* Creates an empty iterable that yields no elements.
|
| 1208 |
*
|
| 1209 |
-
*
|
| 1210 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1211 |
*
|
| 1212 |
-
* @example
|
| 1213 |
* ```ts
|
| 1214 |
* import { Iterable } from "effect"
|
| 1215 |
*
|
|
@@ -1231,12 +1333,13 @@ export const empty = () => constEmpty;
|
|
| 1231 |
/**
|
| 1232 |
* Creates an iterable containing a single element.
|
| 1233 |
*
|
| 1234 |
-
*
|
| 1235 |
-
* allowing it to be used with other iterable operations.
|
| 1236 |
*
|
| 1237 |
-
*
|
|
|
|
|
|
|
|
|
|
| 1238 |
*
|
| 1239 |
-
* @example
|
| 1240 |
* ```ts
|
| 1241 |
* import { Iterable } from "effect"
|
| 1242 |
*
|
|
@@ -1266,15 +1369,15 @@ export const of = a => [a];
|
|
| 1266 |
/**
|
| 1267 |
* Transforms each element of an iterable using a function.
|
| 1268 |
*
|
|
|
|
|
|
|
| 1269 |
* This is one of the most fundamental operations for working with iterables.
|
| 1270 |
* It applies a transformation function to each element, creating a new iterable
|
| 1271 |
-
* with the transformed values. The operation is lazy
|
| 1272 |
* transformed when the iterable is consumed.
|
| 1273 |
*
|
| 1274 |
-
*
|
| 1275 |
-
* @param f - Function that transforms each element (receives value and index)
|
| 1276 |
*
|
| 1277 |
-
* @example
|
| 1278 |
* ```ts
|
| 1279 |
* import { Iterable } from "effect"
|
| 1280 |
*
|
|
@@ -1322,7 +1425,8 @@ export const map = /*#__PURE__*/dual(2, (self, f) => ({
|
|
| 1322 |
/**
|
| 1323 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 1324 |
*
|
| 1325 |
-
*
|
|
|
|
| 1326 |
* ```ts
|
| 1327 |
* import { Iterable } from "effect"
|
| 1328 |
*
|
|
@@ -1360,7 +1464,8 @@ export const flatMap = /*#__PURE__*/dual(2, (self, f) => flatten(map(self, f)));
|
|
| 1360 |
/**
|
| 1361 |
* Flattens an Iterable of Iterables into a single Iterable
|
| 1362 |
*
|
| 1363 |
-
*
|
|
|
|
| 1364 |
* ```ts
|
| 1365 |
* import { Iterable } from "effect"
|
| 1366 |
*
|
|
@@ -1416,13 +1521,16 @@ export const flatten = self => ({
|
|
| 1416 |
/**
|
| 1417 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 1418 |
*
|
| 1419 |
-
*
|
| 1420 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1421 |
*
|
| 1422 |
-
* @example
|
| 1423 |
* ```ts
|
| 1424 |
-
* import { Iterable } from "effect"
|
| 1425 |
-
* import * as Result from "effect/Result"
|
| 1426 |
*
|
| 1427 |
* // Parse strings to numbers, keeping only valid ones
|
| 1428 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
@@ -1486,10 +1594,10 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => ({
|
|
| 1486 |
/**
|
| 1487 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 1488 |
*
|
| 1489 |
-
*
|
|
|
|
| 1490 |
* ```ts
|
| 1491 |
-
* import { Iterable } from "effect"
|
| 1492 |
-
* import * as Result from "effect/Result"
|
| 1493 |
*
|
| 1494 |
* // Parse numbers until we hit an invalid one
|
| 1495 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
@@ -1550,10 +1658,10 @@ export const filterMapWhile = /*#__PURE__*/dual(2, (self, f) => ({
|
|
| 1550 |
/**
|
| 1551 |
* Retrieves the `Some` values from an `Iterable` of `Option`s.
|
| 1552 |
*
|
| 1553 |
-
*
|
|
|
|
| 1554 |
* ```ts
|
| 1555 |
-
* import { Iterable } from "effect"
|
| 1556 |
-
* import * as Option from "effect/Option"
|
| 1557 |
* import * as assert from "node:assert"
|
| 1558 |
*
|
| 1559 |
* assert.deepStrictEqual(
|
|
@@ -1593,12 +1701,13 @@ export const getSomes = self => {
|
|
| 1593 |
};
|
| 1594 |
};
|
| 1595 |
/**
|
| 1596 |
-
*
|
|
|
|
|
|
|
|
|
|
| 1597 |
*
|
| 1598 |
-
* @example
|
| 1599 |
* ```ts
|
| 1600 |
-
* import { Iterable } from "effect"
|
| 1601 |
-
* import * as Result from "effect/Result"
|
| 1602 |
* import * as assert from "node:assert"
|
| 1603 |
*
|
| 1604 |
* assert.deepStrictEqual(
|
|
@@ -1614,7 +1723,7 @@ export const getSomes = self => {
|
|
| 1614 |
* ```
|
| 1615 |
*
|
| 1616 |
* @category filtering
|
| 1617 |
-
* @since
|
| 1618 |
*/
|
| 1619 |
export const getFailures = self => {
|
| 1620 |
return {
|
|
@@ -1642,12 +1751,13 @@ export const getFailures = self => {
|
|
| 1642 |
};
|
| 1643 |
};
|
| 1644 |
/**
|
| 1645 |
-
*
|
|
|
|
|
|
|
|
|
|
| 1646 |
*
|
| 1647 |
-
* @example
|
| 1648 |
* ```ts
|
| 1649 |
-
* import { Iterable } from "effect"
|
| 1650 |
-
* import * as Result from "effect/Result"
|
| 1651 |
* import * as assert from "node:assert"
|
| 1652 |
*
|
| 1653 |
* assert.deepStrictEqual(
|
|
@@ -1663,7 +1773,7 @@ export const getFailures = self => {
|
|
| 1663 |
* ```
|
| 1664 |
*
|
| 1665 |
* @category filtering
|
| 1666 |
-
* @since
|
| 1667 |
*/
|
| 1668 |
export const getSuccesses = self => {
|
| 1669 |
return {
|
|
@@ -1693,14 +1803,14 @@ export const getSuccesses = self => {
|
|
| 1693 |
/**
|
| 1694 |
* Filters an iterable to only include elements that match a predicate.
|
| 1695 |
*
|
|
|
|
|
|
|
| 1696 |
* This function creates a new iterable containing only the elements for which
|
| 1697 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 1698 |
* elements are only tested when the iterable is consumed.
|
| 1699 |
*
|
| 1700 |
-
*
|
| 1701 |
-
* @param predicate - Function that tests each element (receives value and index)
|
| 1702 |
*
|
| 1703 |
-
* @example
|
| 1704 |
* ```ts
|
| 1705 |
* import { Iterable } from "effect"
|
| 1706 |
*
|
|
@@ -1760,10 +1870,13 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
| 1760 |
/**
|
| 1761 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 1762 |
*
|
| 1763 |
-
*
|
| 1764 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1765 |
*
|
| 1766 |
-
* @example
|
| 1767 |
* ```ts
|
| 1768 |
* import { Iterable } from "effect"
|
| 1769 |
*
|
|
@@ -1797,16 +1910,17 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
| 1797 |
* ```
|
| 1798 |
*
|
| 1799 |
* @category sequencing
|
| 1800 |
-
* @since
|
| 1801 |
*/
|
| 1802 |
export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => filterMap(self, a => {
|
| 1803 |
const b = f(a);
|
| 1804 |
return b == null ? R.failVoid : R.succeed(b);
|
| 1805 |
}));
|
| 1806 |
/**
|
| 1807 |
-
*
|
|
|
|
|
|
|
| 1808 |
*
|
| 1809 |
-
* @example
|
| 1810 |
* ```ts
|
| 1811 |
* import { Iterable } from "effect"
|
| 1812 |
*
|
|
@@ -1856,11 +1970,14 @@ export const some = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
| 1856 |
* Generates an iterable by repeatedly applying a function that produces the
|
| 1857 |
* next element and state.
|
| 1858 |
*
|
|
|
|
|
|
|
| 1859 |
* This is useful for creating iterables from a generating function that
|
| 1860 |
* maintains state. The function should return `Option.some([value, nextState])`
|
| 1861 |
* to continue or `Option.none()` to stop.
|
| 1862 |
*
|
| 1863 |
-
*
|
|
|
|
| 1864 |
* ```ts
|
| 1865 |
* import { Iterable, Option } from "effect"
|
| 1866 |
*
|
|
@@ -1912,9 +2029,10 @@ export const unfold = (b, f) => ({
|
|
| 1912 |
}
|
| 1913 |
});
|
| 1914 |
/**
|
| 1915 |
-
*
|
|
|
|
|
|
|
| 1916 |
*
|
| 1917 |
-
* @example
|
| 1918 |
* ```ts
|
| 1919 |
* import { Iterable } from "effect"
|
| 1920 |
*
|
|
@@ -1955,12 +2073,15 @@ export const forEach = /*#__PURE__*/dual(2, (self, f) => {
|
|
| 1955 |
}
|
| 1956 |
});
|
| 1957 |
/**
|
| 1958 |
-
*
|
|
|
|
|
|
|
| 1959 |
*
|
| 1960 |
* This function applies a reducing function against an accumulator and each element
|
| 1961 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 1962 |
*
|
| 1963 |
-
*
|
|
|
|
| 1964 |
* ```ts
|
| 1965 |
* import { Iterable } from "effect"
|
| 1966 |
*
|
|
@@ -2016,7 +2137,8 @@ export const reduce = /*#__PURE__*/dual(3, (self, b, f) => {
|
|
| 2016 |
/**
|
| 2017 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 2018 |
*
|
| 2019 |
-
*
|
|
|
|
| 2020 |
* ```ts
|
| 2021 |
* import { Iterable } from "effect"
|
| 2022 |
*
|
|
@@ -2087,7 +2209,8 @@ export const dedupeAdjacentWith = /*#__PURE__*/dual(2, (self, isEquivalent) => (
|
|
| 2087 |
/**
|
| 2088 |
* Deduplicates adjacent elements that are identical.
|
| 2089 |
*
|
| 2090 |
-
*
|
|
|
|
| 2091 |
* ```ts
|
| 2092 |
* import { Iterable } from "effect"
|
| 2093 |
*
|
|
@@ -2125,7 +2248,8 @@ export const dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(/*#__PURE__*/Equal
|
|
| 2125 |
/**
|
| 2126 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 2127 |
*
|
| 2128 |
-
*
|
|
|
|
| 2129 |
* ```ts
|
| 2130 |
* import { Iterable } from "effect"
|
| 2131 |
*
|
|
@@ -2168,14 +2292,15 @@ export const dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(/*#__PURE__*/Equal
|
|
| 2168 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 2169 |
* ```
|
| 2170 |
*
|
| 2171 |
-
* @since 2.0.0
|
| 2172 |
* @category elements
|
|
|
|
| 2173 |
*/
|
| 2174 |
export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => flatMap(self, a => map(that, b => f(a, b))));
|
| 2175 |
/**
|
| 2176 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 2177 |
*
|
| 2178 |
-
*
|
|
|
|
| 2179 |
* ```ts
|
| 2180 |
* import { Iterable } from "effect"
|
| 2181 |
*
|
|
@@ -2209,14 +2334,14 @@ export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => flatMap(sel
|
|
| 2209 |
* console.log(Array.from(withEmpty)) // []
|
| 2210 |
* ```
|
| 2211 |
*
|
| 2212 |
-
* @since 2.0.0
|
| 2213 |
* @category elements
|
|
|
|
| 2214 |
*/
|
| 2215 |
export const cartesian = /*#__PURE__*/dual(2, (self, that) => cartesianWith(self, that, (a, b) => [a, b]));
|
| 2216 |
/**
|
| 2217 |
-
*
|
| 2218 |
*
|
| 2219 |
-
* **Example**
|
| 2220 |
*
|
| 2221 |
* ```ts
|
| 2222 |
* import { Iterable } from "effect"
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Works with JavaScript values that implement `[Symbol.iterator]`.
|
| 3 |
*
|
| 4 |
+
* Iterables include arrays, strings, generators, sets, and custom lazy
|
| 5 |
+
* sequences. The helpers in this module let code transform, search, group, and
|
| 6 |
+
* fold iterable values while preserving the input as an iterable instead of
|
| 7 |
+
* forcing an array first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
*
|
| 9 |
* @since 2.0.0
|
| 10 |
*/
|
|
|
|
| 17 |
/**
|
| 18 |
* Creates an iterable by applying a function to consecutive integers.
|
| 19 |
*
|
| 20 |
+
* **Details**
|
| 21 |
+
*
|
| 22 |
+
* The function is called with each index starting from `0`. If no length is
|
| 23 |
+
* specified, the iterable is infinite. This is useful for generating
|
| 24 |
+
* sequences, patterns, or any indexed data.
|
| 25 |
*
|
| 26 |
+
* **Example** (Generating values by index)
|
|
|
|
| 27 |
*
|
|
|
|
| 28 |
* ```ts
|
| 29 |
* import { Iterable } from "effect"
|
| 30 |
*
|
|
|
|
| 68 |
};
|
| 69 |
};
|
| 70 |
/**
|
| 71 |
+
* Returns an iterable of integers starting at `start` and increasing by `1`.
|
| 72 |
+
*
|
| 73 |
+
* **Details**
|
| 74 |
+
*
|
| 75 |
+
* When `end` is provided and `start <= end`, both endpoints are included. When
|
| 76 |
+
* `end` is omitted, the iterable is unbounded. When `start > end`, the
|
| 77 |
+
* iterable contains only `start`.
|
| 78 |
*
|
| 79 |
+
* **Example** (Creating a range)
|
| 80 |
*
|
|
|
|
| 81 |
* ```ts
|
| 82 |
+
* import { Iterable } from "effect"
|
| 83 |
* import * as assert from "node:assert"
|
| 84 |
*
|
| 85 |
+
* assert.deepStrictEqual(Array.from(Iterable.range(1, 3)), [1, 2, 3])
|
| 86 |
* ```
|
| 87 |
*
|
| 88 |
* @category constructors
|
|
|
|
| 97 |
});
|
| 98 |
};
|
| 99 |
/**
|
| 100 |
+
* Returns a `Iterable` containing a value repeated the specified number of times.
|
| 101 |
+
*
|
| 102 |
+
* **Details**
|
| 103 |
*
|
| 104 |
+
* `n` is normalized to an integer greater than or equal to `1`.
|
| 105 |
+
*
|
| 106 |
+
* **Example** (Repeating a value)
|
| 107 |
*
|
|
|
|
| 108 |
* ```ts
|
| 109 |
+
* import { Iterable } from "effect"
|
| 110 |
* import * as assert from "node:assert"
|
| 111 |
*
|
| 112 |
+
* assert.deepStrictEqual(Array.from(Iterable.replicate("a", 3)), ["a", "a", "a"])
|
| 113 |
* ```
|
| 114 |
*
|
| 115 |
* @category constructors
|
|
|
|
| 119 |
length: n
|
| 120 |
}));
|
| 121 |
/**
|
| 122 |
+
* Repeats an iterable `n` times, yielding the full contents of `self` for each
|
| 123 |
+
* repetition.
|
| 124 |
+
*
|
| 125 |
+
* **When to use**
|
| 126 |
+
*
|
| 127 |
+
* Use to repeat an iterable's contents a specific number of times.
|
| 128 |
+
*
|
| 129 |
+
* **Details**
|
| 130 |
+
*
|
| 131 |
+
* The result is lazy. Each repetition obtains a new iterator from `self`.
|
| 132 |
+
*
|
| 133 |
+
* @see {@link forever} for repeating without an upper bound
|
| 134 |
+
* @see {@link replicate} for repeating a single value
|
| 135 |
* @category constructors
|
| 136 |
* @since 4.0.0
|
| 137 |
*/
|
|
|
|
| 139 |
length: n
|
| 140 |
})));
|
| 141 |
/**
|
| 142 |
+
* Repeats an iterable without an upper bound.
|
| 143 |
+
*
|
| 144 |
+
* **When to use**
|
| 145 |
+
*
|
| 146 |
+
* Use to cycle a reusable iterable without an upper bound when a downstream
|
| 147 |
+
* consumer controls how many values are taken.
|
| 148 |
+
*
|
| 149 |
+
* **Gotchas**
|
| 150 |
+
*
|
| 151 |
+
* The returned iterable is lazy and should usually be bounded with `take` or
|
| 152 |
+
* another terminating consumer before materializing it.
|
| 153 |
+
*
|
| 154 |
+
* @see {@link repeat} for repeating an iterable a specific number of times
|
| 155 |
+
* @see {@link take} for bounding the unbounded result before materializing it
|
| 156 |
+
*
|
| 157 |
* @category constructors
|
| 158 |
* @since 4.0.0
|
| 159 |
*/
|
|
|
|
| 161 |
/**
|
| 162 |
* Takes a record and returns an Iterable of tuples containing its keys and values.
|
| 163 |
*
|
| 164 |
+
* **Example** (Converting a record to entries)
|
| 165 |
+
*
|
| 166 |
* ```ts
|
| 167 |
+
* import { Iterable } from "effect"
|
| 168 |
* import * as assert from "node:assert"
|
| 169 |
*
|
| 170 |
* const x = { a: 1, b: 2, c: 3 }
|
| 171 |
+
* assert.deepStrictEqual(Array.from(Iterable.fromRecord(x)), [["a", 1], ["b", 2], [
|
| 172 |
* "c",
|
| 173 |
* 3
|
| 174 |
* ]])
|
| 175 |
* ```
|
| 176 |
*
|
| 177 |
+
* @category converting
|
| 178 |
* @since 2.0.0
|
| 179 |
*/
|
| 180 |
export const fromRecord = self => ({
|
|
|
|
| 187 |
}
|
| 188 |
});
|
| 189 |
/**
|
| 190 |
+
* Prepends an element to the front of an `Iterable`, creating a new `Iterable`.
|
| 191 |
+
*
|
| 192 |
+
* **Example** (Prepending an element)
|
| 193 |
*
|
|
|
|
| 194 |
* ```ts
|
| 195 |
* import { Iterable } from "effect"
|
| 196 |
*
|
|
|
|
| 204 |
* console.log(Array.from(withZ)) // ["z", "a", "b", "c"]
|
| 205 |
* ```
|
| 206 |
*
|
| 207 |
+
* @category combining
|
| 208 |
* @since 2.0.0
|
| 209 |
*/
|
| 210 |
export const prepend = /*#__PURE__*/dual(2, (self, head) => prependAll(self, [head]));
|
| 211 |
/**
|
| 212 |
* Prepends the specified prefix iterable to the beginning of the specified iterable.
|
| 213 |
*
|
| 214 |
+
* **Example** (Prepending another iterable)
|
| 215 |
+
*
|
| 216 |
* ```ts
|
| 217 |
* import { Iterable } from "effect"
|
| 218 |
* import * as assert from "node:assert"
|
|
|
|
| 223 |
* )
|
| 224 |
* ```
|
| 225 |
*
|
| 226 |
+
* @category combining
|
| 227 |
* @since 2.0.0
|
| 228 |
*/
|
| 229 |
export const prependAll = /*#__PURE__*/dual(2, (self, that) => appendAll(that, self));
|
| 230 |
/**
|
| 231 |
+
* Appends an element to the end of an `Iterable`, creating a new `Iterable`.
|
| 232 |
+
*
|
| 233 |
+
* **When to use**
|
| 234 |
+
*
|
| 235 |
+
* Use to add one element after all elements of an iterable while keeping the
|
| 236 |
+
* result as a lazy `Iterable`.
|
| 237 |
+
*
|
| 238 |
+
* **Details**
|
| 239 |
+
*
|
| 240 |
+
* The result yields every element from `self` first, then yields `last` after
|
| 241 |
+
* `self` is exhausted.
|
| 242 |
+
*
|
| 243 |
+
* **Gotchas**
|
| 244 |
+
*
|
| 245 |
+
* If `self` is infinite or never completes, the appended element is never
|
| 246 |
+
* reached.
|
| 247 |
+
*
|
| 248 |
+
* **Example** (Appending an element)
|
| 249 |
*
|
|
|
|
| 250 |
* ```ts
|
| 251 |
* import { Iterable } from "effect"
|
| 252 |
*
|
|
|
|
| 262 |
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
| 263 |
* ```
|
| 264 |
*
|
| 265 |
+
* @see {@link prepend} for adding one element before the existing elements
|
| 266 |
+
* @see {@link appendAll} for appending all elements from another iterable
|
| 267 |
+
*
|
| 268 |
+
* @category combining
|
| 269 |
* @since 2.0.0
|
| 270 |
*/
|
| 271 |
export const append = /*#__PURE__*/dual(2, (self, last) => appendAll(self, [last]));
|
| 272 |
/**
|
| 273 |
* Concatenates two iterables, combining their elements.
|
| 274 |
*
|
| 275 |
+
* **When to use**
|
| 276 |
+
*
|
| 277 |
+
* Use to lazily concatenate two iterables while preserving order, yielding all
|
| 278 |
+
* elements from `self` before `that`.
|
| 279 |
+
*
|
| 280 |
+
* **Details**
|
| 281 |
+
*
|
| 282 |
+
* The result is lazy. The iterator for `that` is not created or read until
|
| 283 |
+
* `self` is exhausted.
|
| 284 |
+
*
|
| 285 |
+
* **Gotchas**
|
| 286 |
+
*
|
| 287 |
+
* If `self` is infinite or never completes, `that` is never reached.
|
| 288 |
+
*
|
| 289 |
+
* **Example** (Concatenating iterables)
|
| 290 |
+
*
|
| 291 |
* ```ts
|
| 292 |
* import { Iterable } from "effect"
|
| 293 |
*
|
|
|
|
| 309 |
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
| 310 |
* ```
|
| 311 |
*
|
| 312 |
+
* @see {@link append} for appending one value instead of another iterable
|
| 313 |
+
* @see {@link prependAll} for yielding another iterable before `self`
|
| 314 |
+
*
|
| 315 |
+
* @category combining
|
| 316 |
* @since 2.0.0
|
| 317 |
*/
|
| 318 |
export const appendAll = /*#__PURE__*/dual(2, (self, that) => ({
|
|
|
|
| 337 |
}
|
| 338 |
}));
|
| 339 |
/**
|
| 340 |
+
* Reduces an `Iterable` from the left, keeping all intermediate results instead of only the final result.
|
| 341 |
+
*
|
| 342 |
+
* **Example** (Tracking running results)
|
| 343 |
*
|
|
|
|
| 344 |
* ```ts
|
| 345 |
* import { Iterable } from "effect"
|
| 346 |
*
|
|
|
|
| 391 |
}
|
| 392 |
}));
|
| 393 |
/**
|
| 394 |
+
* Checks whether an `Iterable` is empty.
|
| 395 |
+
*
|
| 396 |
+
* **Example** (Checking for emptiness)
|
| 397 |
*
|
|
|
|
| 398 |
* ```ts
|
| 399 |
+
* import { Iterable } from "effect"
|
| 400 |
* import * as assert from "node:assert"
|
| 401 |
*
|
| 402 |
+
* assert.deepStrictEqual(Iterable.isEmpty([]), true)
|
| 403 |
+
* assert.deepStrictEqual(Iterable.isEmpty([1, 2, 3]), false)
|
| 404 |
* ```
|
| 405 |
*
|
| 406 |
* @category guards
|
|
|
|
| 411 |
return iterator.next().done === true;
|
| 412 |
};
|
| 413 |
/**
|
| 414 |
+
* Returns the number of elements in a `Iterable`.
|
| 415 |
+
*
|
| 416 |
+
* **Example** (Counting iterable elements)
|
| 417 |
*
|
|
|
|
| 418 |
* ```ts
|
| 419 |
* import { Iterable } from "effect"
|
| 420 |
*
|
|
|
|
| 445 |
return count;
|
| 446 |
};
|
| 447 |
/**
|
| 448 |
+
* Gets the first element of a `Iterable` safely, or `None` if the `Iterable` is empty.
|
| 449 |
+
*
|
| 450 |
+
* **Example** (Getting the first element)
|
| 451 |
*
|
|
|
|
| 452 |
* ```ts
|
| 453 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 454 |
*
|
| 455 |
* const numbers = [1, 2, 3]
|
| 456 |
* console.log(Iterable.head(numbers)) // Option.some(1)
|
|
|
|
| 478 |
return result.done ? O.none() : O.some(result.value);
|
| 479 |
};
|
| 480 |
/**
|
| 481 |
+
* Gets the first element of an `Iterable` without returning an `Option`.
|
| 482 |
+
*
|
| 483 |
+
* **When to use**
|
| 484 |
+
*
|
| 485 |
+
* Use when the `Iterable` is known to be non-empty and direct access to the
|
| 486 |
+
* first element is preferred over handling `Option.none`.
|
| 487 |
+
*
|
| 488 |
+
* **Gotchas**
|
| 489 |
+
*
|
| 490 |
+
* Throws if the `Iterable` is empty.
|
| 491 |
+
*
|
| 492 |
+
* **Example** (Getting the first element unsafely)
|
| 493 |
*
|
|
|
|
| 494 |
* ```ts
|
| 495 |
* import { Iterable } from "effect"
|
| 496 |
*
|
|
|
|
| 500 |
* const letters = "hello"
|
| 501 |
* console.log(Iterable.headUnsafe(letters)) // "h"
|
| 502 |
*
|
| 503 |
+
* // Iterable.headUnsafe(Iterable.empty<number>())
|
| 504 |
+
* // throws Error: "headUnsafe: empty iterable"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
*
|
| 506 |
* // Use only when you're certain the iterable is non-empty
|
| 507 |
* const nonEmpty = Iterable.range(1, 10)
|
|
|
|
| 509 |
* ```
|
| 510 |
*
|
| 511 |
* @category getters
|
| 512 |
+
* @since 4.0.0
|
| 513 |
*/
|
| 514 |
export const headUnsafe = self => {
|
| 515 |
const iterator = self[Symbol.iterator]();
|
|
|
|
| 518 |
return result.value;
|
| 519 |
};
|
| 520 |
/**
|
| 521 |
+
* Keeps only a max number of elements from the start of an `Iterable`, creating a new `Iterable`.
|
| 522 |
*
|
| 523 |
+
* **Details**
|
| 524 |
+
*
|
| 525 |
+
* `n` is normalized to a non-negative integer.
|
| 526 |
+
*
|
| 527 |
+
* **Example** (Taking from the start)
|
| 528 |
*
|
|
|
|
| 529 |
* ```ts
|
| 530 |
* import { Iterable } from "effect"
|
| 531 |
*
|
|
|
|
| 569 |
}
|
| 570 |
}));
|
| 571 |
/**
|
| 572 |
+
* Takes the longest initial `Iterable` prefix for which all elements satisfy the
|
| 573 |
+
* specified predicate.
|
| 574 |
+
*
|
| 575 |
+
* **Example** (Taking while a predicate holds)
|
| 576 |
*
|
|
|
|
| 577 |
* ```ts
|
| 578 |
* import { Iterable } from "effect"
|
| 579 |
*
|
|
|
|
| 622 |
}
|
| 623 |
}));
|
| 624 |
/**
|
| 625 |
+
* Drops a max number of elements from the start of an `Iterable`
|
| 626 |
+
*
|
| 627 |
+
* **Details**
|
| 628 |
*
|
| 629 |
+
* `n` is normalized to a non-negative integer.
|
| 630 |
+
*
|
| 631 |
+
* **Example** (Dropping from the start)
|
| 632 |
*
|
|
|
|
| 633 |
* ```ts
|
| 634 |
* import { Iterable } from "effect"
|
| 635 |
*
|
|
|
|
| 678 |
* Returns the first element that satisfies the specified
|
| 679 |
* predicate, or `None` if no such element exists.
|
| 680 |
*
|
| 681 |
+
* **Example** (Finding the first match)
|
| 682 |
+
*
|
| 683 |
* ```ts
|
| 684 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 685 |
*
|
| 686 |
* const numbers = [1, 3, 4, 6, 8]
|
| 687 |
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
|
|
| 732 |
return O.none();
|
| 733 |
});
|
| 734 |
/**
|
| 735 |
+
* Finds the last element for which a predicate holds.
|
| 736 |
+
*
|
| 737 |
+
* **Example** (Finding the last match)
|
| 738 |
*
|
|
|
|
| 739 |
* ```ts
|
| 740 |
* import { Iterable } from "effect"
|
| 741 |
*
|
|
|
|
| 784 |
/**
|
| 785 |
* Takes two `Iterable`s and returns an `Iterable` of corresponding pairs.
|
| 786 |
*
|
| 787 |
+
* **Example** (Zipping iterables)
|
| 788 |
+
*
|
| 789 |
* ```ts
|
| 790 |
* import { Iterable } from "effect"
|
| 791 |
*
|
|
|
|
| 818 |
*/
|
| 819 |
export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tuple.make));
|
| 820 |
/**
|
| 821 |
+
* Applies a function to pairs of elements at the same index in two `Iterable`s, collecting the results. If one
|
| 822 |
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
| 823 |
*
|
| 824 |
+
* **Example** (Zipping with a combining function)
|
| 825 |
+
*
|
| 826 |
* ```ts
|
| 827 |
* import { Iterable } from "effect"
|
| 828 |
*
|
|
|
|
| 887 |
}
|
| 888 |
}));
|
| 889 |
/**
|
| 890 |
+
* Places a separator between members of an `Iterable`.
|
| 891 |
+
*
|
| 892 |
+
* **When to use**
|
| 893 |
+
*
|
| 894 |
+
* Use to lazily insert a separator between adjacent values.
|
| 895 |
+
*
|
| 896 |
+
* **Details**
|
| 897 |
+
*
|
| 898 |
* If the input is a non-empty array, the result is also a non-empty array.
|
| 899 |
*
|
| 900 |
+
* **Example** (Interspersing separators)
|
| 901 |
+
*
|
| 902 |
* ```ts
|
| 903 |
* import { Iterable } from "effect"
|
| 904 |
*
|
|
|
|
| 928 |
* console.log(Array.from(css).join("")) // "color: red; font-size: 14px; margin: 10px"
|
| 929 |
* ```
|
| 930 |
*
|
| 931 |
+
* @category combining
|
| 932 |
* @since 2.0.0
|
| 933 |
*/
|
| 934 |
export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
|
|
| 958 |
/**
|
| 959 |
* Returns a function that checks if an `Iterable` contains a given value using a provided `isEquivalent` function.
|
| 960 |
*
|
| 961 |
+
* **Example** (Checking membership with custom equivalence)
|
| 962 |
+
*
|
| 963 |
* ```ts
|
| 964 |
* import { Iterable } from "effect"
|
| 965 |
*
|
|
|
|
| 1001 |
return false;
|
| 1002 |
});
|
| 1003 |
/**
|
| 1004 |
+
* Checks whether an iterable contains a value using Effect's default `Equal`
|
| 1005 |
+
* equivalence.
|
| 1006 |
+
*
|
| 1007 |
+
* **Details**
|
| 1008 |
+
*
|
| 1009 |
+
* Can be called as `contains(self, value)` or curried as
|
| 1010 |
+
* `contains(value)(self)`.
|
| 1011 |
+
*
|
| 1012 |
+
* **Example** (Checking membership)
|
| 1013 |
*
|
|
|
|
| 1014 |
* ```ts
|
| 1015 |
* import { Iterable } from "effect"
|
| 1016 |
*
|
|
|
|
| 1041 |
* Splits an `Iterable` into length-`n` pieces. The last piece will be shorter if `n` does not evenly divide the length of
|
| 1042 |
* the `Iterable`.
|
| 1043 |
*
|
| 1044 |
+
* **Example** (Chunking an iterable)
|
| 1045 |
+
*
|
| 1046 |
* ```ts
|
| 1047 |
* import { Iterable } from "effect"
|
| 1048 |
*
|
|
|
|
| 1114 |
};
|
| 1115 |
});
|
| 1116 |
/**
|
| 1117 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
| 1118 |
+
*
|
| 1119 |
+
* **Example** (Grouping consecutive elements with custom equivalence)
|
| 1120 |
*
|
|
|
|
| 1121 |
* ```ts
|
| 1122 |
* import { Iterable } from "effect"
|
| 1123 |
*
|
|
|
|
| 1194 |
}
|
| 1195 |
}));
|
| 1196 |
/**
|
| 1197 |
+
* Groups equal, consecutive elements of an `Iterable` into `NonEmptyArray`s.
|
| 1198 |
+
*
|
| 1199 |
+
* **Example** (Grouping consecutive elements)
|
| 1200 |
*
|
|
|
|
| 1201 |
* ```ts
|
| 1202 |
* import { Iterable } from "effect"
|
| 1203 |
*
|
|
|
|
| 1228 |
*/
|
| 1229 |
export const group = /*#__PURE__*/groupWith(/*#__PURE__*/Equal.asEquivalence());
|
| 1230 |
/**
|
| 1231 |
+
* Groups all elements by the string or symbol key returned by `f`.
|
| 1232 |
+
*
|
| 1233 |
+
* **Details**
|
| 1234 |
+
*
|
| 1235 |
+
* Each property in the returned record contains a non-empty array of elements
|
| 1236 |
+
* that produced that key. Unlike `group`, matching elements do not need to be
|
| 1237 |
+
* consecutive.
|
| 1238 |
+
*
|
| 1239 |
+
* **Example** (Grouping by a key)
|
| 1240 |
*
|
|
|
|
| 1241 |
* ```ts
|
| 1242 |
* import { Iterable } from "effect"
|
| 1243 |
*
|
|
|
|
| 1305 |
/**
|
| 1306 |
* Creates an empty iterable that yields no elements.
|
| 1307 |
*
|
| 1308 |
+
* **When to use**
|
| 1309 |
+
*
|
| 1310 |
+
* Use when you need an empty iterable as a typed "no data" value or a base
|
| 1311 |
+
* case for iterable operations.
|
| 1312 |
+
*
|
| 1313 |
+
* **Example** (Creating an empty iterable)
|
| 1314 |
*
|
|
|
|
| 1315 |
* ```ts
|
| 1316 |
* import { Iterable } from "effect"
|
| 1317 |
*
|
|
|
|
| 1333 |
/**
|
| 1334 |
* Creates an iterable containing a single element.
|
| 1335 |
*
|
| 1336 |
+
* **When to use**
|
|
|
|
| 1337 |
*
|
| 1338 |
+
* Use to wrap a single value in an iterable context so it can be combined
|
| 1339 |
+
* with other iterable operations.
|
| 1340 |
+
*
|
| 1341 |
+
* **Example** (Wrapping a single value)
|
| 1342 |
*
|
|
|
|
| 1343 |
* ```ts
|
| 1344 |
* import { Iterable } from "effect"
|
| 1345 |
*
|
|
|
|
| 1369 |
/**
|
| 1370 |
* Transforms each element of an iterable using a function.
|
| 1371 |
*
|
| 1372 |
+
* **Details**
|
| 1373 |
+
*
|
| 1374 |
* This is one of the most fundamental operations for working with iterables.
|
| 1375 |
* It applies a transformation function to each element, creating a new iterable
|
| 1376 |
+
* with the transformed values. The operation is lazy, so elements are only
|
| 1377 |
* transformed when the iterable is consumed.
|
| 1378 |
*
|
| 1379 |
+
* **Example** (Mapping elements)
|
|
|
|
| 1380 |
*
|
|
|
|
| 1381 |
* ```ts
|
| 1382 |
* import { Iterable } from "effect"
|
| 1383 |
*
|
|
|
|
| 1425 |
/**
|
| 1426 |
* Applies a function to each element in an Iterable and returns a new Iterable containing the concatenated mapped elements.
|
| 1427 |
*
|
| 1428 |
+
* **Example** (FlatMapping iterables)
|
| 1429 |
+
*
|
| 1430 |
* ```ts
|
| 1431 |
* import { Iterable } from "effect"
|
| 1432 |
*
|
|
|
|
| 1464 |
/**
|
| 1465 |
* Flattens an Iterable of Iterables into a single Iterable
|
| 1466 |
*
|
| 1467 |
+
* **Example** (Flattening nested iterables)
|
| 1468 |
+
*
|
| 1469 |
* ```ts
|
| 1470 |
* import { Iterable } from "effect"
|
| 1471 |
*
|
|
|
|
| 1521 |
/**
|
| 1522 |
* Transforms elements of an iterable using a function that returns a `Result`, keeping only successful values.
|
| 1523 |
*
|
| 1524 |
+
* **Details**
|
| 1525 |
+
*
|
| 1526 |
+
* This combines mapping and filtering in a single operation. The function is
|
| 1527 |
+
* applied to each element, and only elements that result in `Result.succeed`
|
| 1528 |
+
* are included in the result.
|
| 1529 |
+
*
|
| 1530 |
+
* **Example** (Filtering and transforming Result values)
|
| 1531 |
*
|
|
|
|
| 1532 |
* ```ts
|
| 1533 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 1534 |
*
|
| 1535 |
* // Parse strings to numbers, keeping only valid ones
|
| 1536 |
* const strings = ["1", "2", "invalid", "4", "not-a-number"]
|
|
|
|
| 1594 |
/**
|
| 1595 |
* Transforms all elements of the `Iterable` for as long as the specified function succeeds.
|
| 1596 |
*
|
| 1597 |
+
* **Example** (Filtering and transforming until failure)
|
| 1598 |
+
*
|
| 1599 |
* ```ts
|
| 1600 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 1601 |
*
|
| 1602 |
* // Parse numbers until we hit an invalid one
|
| 1603 |
* const strings = ["1", "2", "3", "invalid", "4", "5"]
|
|
|
|
| 1658 |
/**
|
| 1659 |
* Retrieves the `Some` values from an `Iterable` of `Option`s.
|
| 1660 |
*
|
| 1661 |
+
* **Example** (Extracting Some values)
|
| 1662 |
+
*
|
| 1663 |
* ```ts
|
| 1664 |
+
* import { Iterable, Option } from "effect"
|
|
|
|
| 1665 |
* import * as assert from "node:assert"
|
| 1666 |
*
|
| 1667 |
* assert.deepStrictEqual(
|
|
|
|
| 1701 |
};
|
| 1702 |
};
|
| 1703 |
/**
|
| 1704 |
+
* Returns a lazy iterable containing the failure values from an iterable of
|
| 1705 |
+
* `Result`s, skipping successful results.
|
| 1706 |
+
*
|
| 1707 |
+
* **Example** (Extracting failures)
|
| 1708 |
*
|
|
|
|
| 1709 |
* ```ts
|
| 1710 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 1711 |
* import * as assert from "node:assert"
|
| 1712 |
*
|
| 1713 |
* assert.deepStrictEqual(
|
|
|
|
| 1723 |
* ```
|
| 1724 |
*
|
| 1725 |
* @category filtering
|
| 1726 |
+
* @since 4.0.0
|
| 1727 |
*/
|
| 1728 |
export const getFailures = self => {
|
| 1729 |
return {
|
|
|
|
| 1751 |
};
|
| 1752 |
};
|
| 1753 |
/**
|
| 1754 |
+
* Returns a lazy iterable containing the success values from an iterable of
|
| 1755 |
+
* `Result`s, skipping failed results.
|
| 1756 |
+
*
|
| 1757 |
+
* **Example** (Extracting successes)
|
| 1758 |
*
|
|
|
|
| 1759 |
* ```ts
|
| 1760 |
+
* import { Iterable, Result } from "effect"
|
|
|
|
| 1761 |
* import * as assert from "node:assert"
|
| 1762 |
*
|
| 1763 |
* assert.deepStrictEqual(
|
|
|
|
| 1773 |
* ```
|
| 1774 |
*
|
| 1775 |
* @category filtering
|
| 1776 |
+
* @since 4.0.0
|
| 1777 |
*/
|
| 1778 |
export const getSuccesses = self => {
|
| 1779 |
return {
|
|
|
|
| 1803 |
/**
|
| 1804 |
* Filters an iterable to only include elements that match a predicate.
|
| 1805 |
*
|
| 1806 |
+
* **Details**
|
| 1807 |
+
*
|
| 1808 |
* This function creates a new iterable containing only the elements for which
|
| 1809 |
* the predicate function returns true. Like map, this operation is lazy and
|
| 1810 |
* elements are only tested when the iterable is consumed.
|
| 1811 |
*
|
| 1812 |
+
* **Example** (Filtering elements)
|
|
|
|
| 1813 |
*
|
|
|
|
| 1814 |
* ```ts
|
| 1815 |
* import { Iterable } from "effect"
|
| 1816 |
*
|
|
|
|
| 1870 |
/**
|
| 1871 |
* Transforms elements using a function that may return null or undefined, filtering out the null/undefined results.
|
| 1872 |
*
|
| 1873 |
+
* **When to use**
|
| 1874 |
+
*
|
| 1875 |
+
* Use when working with APIs or functions that return nullable values,
|
| 1876 |
+
* providing a clean way to filter out null or undefined while transforming.
|
| 1877 |
+
*
|
| 1878 |
+
* **Example** (FlatMapping nullable results)
|
| 1879 |
*
|
|
|
|
| 1880 |
* ```ts
|
| 1881 |
* import { Iterable } from "effect"
|
| 1882 |
*
|
|
|
|
| 1910 |
* ```
|
| 1911 |
*
|
| 1912 |
* @category sequencing
|
| 1913 |
+
* @since 4.0.0
|
| 1914 |
*/
|
| 1915 |
export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => filterMap(self, a => {
|
| 1916 |
const b = f(a);
|
| 1917 |
return b == null ? R.failVoid : R.succeed(b);
|
| 1918 |
}));
|
| 1919 |
/**
|
| 1920 |
+
* Checks whether a predicate holds true for some `Iterable` element.
|
| 1921 |
+
*
|
| 1922 |
+
* **Example** (Checking whether some element matches)
|
| 1923 |
*
|
|
|
|
| 1924 |
* ```ts
|
| 1925 |
* import { Iterable } from "effect"
|
| 1926 |
*
|
|
|
|
| 1970 |
* Generates an iterable by repeatedly applying a function that produces the
|
| 1971 |
* next element and state.
|
| 1972 |
*
|
| 1973 |
+
* **Details**
|
| 1974 |
+
*
|
| 1975 |
* This is useful for creating iterables from a generating function that
|
| 1976 |
* maintains state. The function should return `Option.some([value, nextState])`
|
| 1977 |
* to continue or `Option.none()` to stop.
|
| 1978 |
*
|
| 1979 |
+
* **Example** (Unfolding state into values)
|
| 1980 |
+
*
|
| 1981 |
* ```ts
|
| 1982 |
* import { Iterable, Option } from "effect"
|
| 1983 |
*
|
|
|
|
| 2029 |
}
|
| 2030 |
});
|
| 2031 |
/**
|
| 2032 |
+
* Iterates over the `Iterable`, applying `f` to each element.
|
| 2033 |
+
*
|
| 2034 |
+
* **Example** (Iterating with side effects)
|
| 2035 |
*
|
|
|
|
| 2036 |
* ```ts
|
| 2037 |
* import { Iterable } from "effect"
|
| 2038 |
*
|
|
|
|
| 2073 |
}
|
| 2074 |
});
|
| 2075 |
/**
|
| 2076 |
+
* Reduces an iterable to a single value by applying a function to each element and accumulating the result.
|
| 2077 |
+
*
|
| 2078 |
+
* **Details**
|
| 2079 |
*
|
| 2080 |
* This function applies a reducing function against an accumulator and each element
|
| 2081 |
* of the iterable (from left to right) to reduce it to a single value.
|
| 2082 |
*
|
| 2083 |
+
* **Example** (Reducing an iterable)
|
| 2084 |
+
*
|
| 2085 |
* ```ts
|
| 2086 |
* import { Iterable } from "effect"
|
| 2087 |
*
|
|
|
|
| 2137 |
/**
|
| 2138 |
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
| 2139 |
*
|
| 2140 |
+
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
| 2141 |
+
*
|
| 2142 |
* ```ts
|
| 2143 |
* import { Iterable } from "effect"
|
| 2144 |
*
|
|
|
|
| 2209 |
/**
|
| 2210 |
* Deduplicates adjacent elements that are identical.
|
| 2211 |
*
|
| 2212 |
+
* **Example** (Deduplicating adjacent elements)
|
| 2213 |
+
*
|
| 2214 |
* ```ts
|
| 2215 |
* import { Iterable } from "effect"
|
| 2216 |
*
|
|
|
|
| 2248 |
/**
|
| 2249 |
* Zips this Iterable crosswise with the specified Iterable using the specified combiner.
|
| 2250 |
*
|
| 2251 |
+
* **Example** (Combining cartesian products)
|
| 2252 |
+
*
|
| 2253 |
* ```ts
|
| 2254 |
* import { Iterable } from "effect"
|
| 2255 |
*
|
|
|
|
| 2292 |
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
| 2293 |
* ```
|
| 2294 |
*
|
|
|
|
| 2295 |
* @category elements
|
| 2296 |
+
* @since 2.0.0
|
| 2297 |
*/
|
| 2298 |
export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => flatMap(self, a => map(that, b => f(a, b))));
|
| 2299 |
/**
|
| 2300 |
* Zips this Iterable crosswise with the specified Iterable.
|
| 2301 |
*
|
| 2302 |
+
* **Example** (Generating cartesian pairs)
|
| 2303 |
+
*
|
| 2304 |
* ```ts
|
| 2305 |
* import { Iterable } from "effect"
|
| 2306 |
*
|
|
|
|
| 2334 |
* console.log(Array.from(withEmpty)) // []
|
| 2335 |
* ```
|
| 2336 |
*
|
|
|
|
| 2337 |
* @category elements
|
| 2338 |
+
* @since 2.0.0
|
| 2339 |
*/
|
| 2340 |
export const cartesian = /*#__PURE__*/dual(2, (self, that) => cartesianWith(self, that, (a, b) => [a, b]));
|
| 2341 |
/**
|
| 2342 |
+
* Computes how many elements of the iterable pass the given predicate.
|
| 2343 |
*
|
| 2344 |
+
* **Example** (Counting matching elements)
|
| 2345 |
*
|
| 2346 |
* ```ts
|
| 2347 |
* import { Iterable } from "effect"
|
.opencode/node_modules/effect/dist/Iterable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Iterable.js","names":["Equal","dual","O","isBoolean","R","Tuple","makeBy","f","options","max","length","undefined","Math","floor","Infinity","Symbol","iterator","i","next","value","done","range","start","end","replicate","a","n","repeat","self","flatten","forever","fromRecord","key","Object","hasOwn","prepend","head","prependAll","that","appendAll","append","last","iterA","doneA","iterB","r","scan","b","acc","result","isEmpty","size","count","none","some","headUnsafe","Error","take","takeWhile","predicate","drop","findFirst","o","isSome","findLast","zip","zipWith","make","selfIterator","thatIterator","selfResult","thatResult","intersperse","middle","emitted","containsWith","isEquivalent","contains","asEquivalence","chunksOf","safeN","chunk","push","groupWith","nextResult","group","groupBy","out","k","constEmpty","constEmptyIterator","empty","of","map","flatMap","outerIterator","innerIterator","filterMap","isSuccess","success","filterMapWhile","getSomes","getFailures","isFailure","failure","getSuccesses","filter","flatMapNullishOr","failVoid","succeed","unfold","ab","isNone","forEach","reduce","Array","isArray","dedupeAdjacentWith","first","current","dedupeAdjacent","cartesianWith","cartesian","countBy"],"sources":["../src/Iterable.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,OAAO,KAAKA,KAAK,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,eAAe;AAEpC,OAAO,KAAKC,CAAC,MAAM,aAAa;AAChC,SAASC,SAAS,QAAQ,gBAAgB;AAG1C,OAAO,KAAKC,CAAC,MAAM,aAAa;AAChC,OAAO,KAAKC,KAAK,MAAM,YAAY;AAGnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAO,MAAMC,MAAM,GAAGA,CAAIC,CAAmB,EAAEC,OAE9C,KAAiB;EAChB,MAAMC,GAAG,GAAGD,OAAO,EAAEE,MAAM,KAAKC,SAAS,GAAGC,IAAI,CAACH,GAAG,CAAC,CAAC,EAAEG,IAAI,CAACC,KAAK,CAACL,OAAO,CAACE,MAAM,CAAC,CAAC,GAAGI,QAAQ;EAC9F,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|
+
{"version":3,"file":"Iterable.js","names":["Equal","dual","O","isBoolean","R","Tuple","makeBy","f","options","max","length","undefined","Math","floor","Infinity","Symbol","iterator","i","next","value","done","range","start","end","replicate","a","n","repeat","self","flatten","forever","fromRecord","key","Object","hasOwn","prepend","head","prependAll","that","appendAll","append","last","iterA","doneA","iterB","r","scan","b","acc","result","isEmpty","size","count","none","some","headUnsafe","Error","take","takeWhile","predicate","drop","findFirst","o","isSome","findLast","zip","zipWith","make","selfIterator","thatIterator","selfResult","thatResult","intersperse","middle","emitted","containsWith","isEquivalent","contains","asEquivalence","chunksOf","safeN","chunk","push","groupWith","nextResult","group","groupBy","out","k","constEmpty","constEmptyIterator","empty","of","map","flatMap","outerIterator","innerIterator","filterMap","isSuccess","success","filterMapWhile","getSomes","getFailures","isFailure","failure","getSuccesses","filter","flatMapNullishOr","failVoid","succeed","unfold","ab","isNone","forEach","reduce","Array","isArray","dedupeAdjacentWith","first","current","dedupeAdjacent","cartesianWith","cartesian","countBy"],"sources":["../src/Iterable.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAYA,OAAO,KAAKA,KAAK,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,eAAe;AAEpC,OAAO,KAAKC,CAAC,MAAM,aAAa;AAChC,SAASC,SAAS,QAAQ,gBAAgB;AAG1C,OAAO,KAAKC,CAAC,MAAM,aAAa;AAChC,OAAO,KAAKC,KAAK,MAAM,YAAY;AAGnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,OAAO,MAAMC,MAAM,GAAGA,CAAIC,CAAmB,EAAEC,OAE9C,KAAiB;EAChB,MAAMC,GAAG,GAAGD,OAAO,EAAEE,MAAM,KAAKC,SAAS,GAAGC,IAAI,CAACH,GAAG,CAAC,CAAC,EAAEG,IAAI,CAACC,KAAK,CAACL,OAAO,CAACE,MAAM,CAAC,CAAC,GAAGI,QAAQ;EAC9F,OAAO;IACL,CAACC,MAAM,CAACC,QAAQ,IAAC;MACf,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EAAER,CAAC,CAAC,EAAE;MACXmC,KAAK,EAAE;IACT;IACAnC,CAAC,EAAE;EACL;EACA,OAAOmC,KAAK;AACd,CAAC,CACF","ignoreList":[]}
|
.opencode/node_modules/effect/dist/JsonPatch.d.ts
CHANGED
|
@@ -2,25 +2,24 @@ import type * as Schema from "./Schema.ts";
|
|
| 2 |
/**
|
| 3 |
* A single JSON Patch operation.
|
| 4 |
*
|
| 5 |
-
*
|
| 6 |
*
|
| 7 |
-
*
|
|
|
|
| 8 |
*
|
| 9 |
-
*
|
| 10 |
-
* - Manually constructing patch operations
|
| 11 |
-
* - Type-checking patch operation structures
|
| 12 |
*
|
| 13 |
-
*
|
| 14 |
-
*
|
| 15 |
-
*
|
| 16 |
-
*
|
| 17 |
-
*
|
| 18 |
-
*
|
| 19 |
*
|
| 20 |
* **Example** (All operation types)
|
| 21 |
*
|
| 22 |
* ```ts
|
| 23 |
-
* import
|
| 24 |
*
|
| 25 |
* const addOp: JsonPatch.JsonPatchOperation = {
|
| 26 |
* op: "add",
|
|
@@ -40,33 +39,45 @@ import type * as Schema from "./Schema.ts";
|
|
| 40 |
* }
|
| 41 |
* ```
|
| 42 |
*
|
| 43 |
-
*
|
| 44 |
-
*
|
| 45 |
-
*
|
| 46 |
-
*
|
| 47 |
-
* - {@link apply} - Applies operations to transform documents
|
| 48 |
-
*
|
| 49 |
-
* @category Model
|
| 50 |
* @since 4.0.0
|
| 51 |
*/
|
| 52 |
export type JsonPatchOperation = {
|
| 53 |
readonly op: "add";
|
| 54 |
/**
|
| 55 |
-
* JSON Pointer to the target location.
|
|
|
|
|
|
|
|
|
|
| 56 |
*
|
| 57 |
-
*
|
| 58 |
*/
|
| 59 |
readonly path: string;
|
| 60 |
readonly value: Schema.Json;
|
| 61 |
readonly description?: string;
|
| 62 |
} | {
|
| 63 |
readonly op: "remove";
|
| 64 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
readonly path: string;
|
| 66 |
readonly description?: string;
|
| 67 |
} | {
|
| 68 |
readonly op: "replace";
|
| 69 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
readonly path: string;
|
| 71 |
readonly value: Schema.Json;
|
| 72 |
readonly description?: string;
|
|
@@ -74,26 +85,21 @@ export type JsonPatchOperation = {
|
|
| 74 |
/**
|
| 75 |
* A JSON Patch document (an ordered list of operations).
|
| 76 |
*
|
| 77 |
-
*
|
| 78 |
-
*
|
| 79 |
-
* ## When to use this
|
| 80 |
*
|
| 81 |
-
*
|
| 82 |
-
* - Passing patches between functions or systems
|
| 83 |
-
* - Type-checking patch arrays
|
| 84 |
-
* - Validating patch structure
|
| 85 |
*
|
| 86 |
-
*
|
| 87 |
*
|
| 88 |
-
*
|
| 89 |
-
*
|
| 90 |
-
*
|
| 91 |
-
*
|
| 92 |
*
|
| 93 |
* **Example** (Multi-operation patch)
|
| 94 |
*
|
| 95 |
* ```ts
|
| 96 |
-
* import
|
| 97 |
*
|
| 98 |
* const patch: JsonPatch.JsonPatch = [
|
| 99 |
* { op: "add", path: "/items/-", value: "apple" },
|
|
@@ -105,43 +111,39 @@ export type JsonPatchOperation = {
|
|
| 105 |
* // { count: 5, items: ["apple"] }
|
| 106 |
* ```
|
| 107 |
*
|
| 108 |
-
*
|
| 109 |
-
*
|
| 110 |
-
*
|
| 111 |
-
*
|
| 112 |
-
* - {@link apply} - Executes patches to transform documents
|
| 113 |
-
*
|
| 114 |
-
* @category Model
|
| 115 |
* @since 4.0.0
|
| 116 |
*/
|
| 117 |
export type JsonPatch = ReadonlyArray<JsonPatchOperation>;
|
| 118 |
/**
|
| 119 |
-
*
|
|
|
|
|
|
|
| 120 |
*
|
| 121 |
-
*
|
|
|
|
| 122 |
*
|
| 123 |
-
*
|
| 124 |
*
|
| 125 |
-
*
|
| 126 |
-
*
|
| 127 |
-
*
|
| 128 |
-
*
|
|
|
|
| 129 |
*
|
| 130 |
-
*
|
| 131 |
*
|
| 132 |
-
*
|
| 133 |
-
*
|
| 134 |
-
*
|
| 135 |
-
* - Arrays are compared by index position; no move or copy detection
|
| 136 |
-
* - Objects are compared by key; keys processed in sorted order for stable output
|
| 137 |
-
* - Array removals emitted from highest to lowest index to prevent index shifting
|
| 138 |
-
* - Output is deterministic but not guaranteed to be minimal
|
| 139 |
-
* - Nested structures are recursively diffed
|
| 140 |
*
|
| 141 |
* **Example** (Computing object diff)
|
| 142 |
*
|
| 143 |
* ```ts
|
| 144 |
-
* import
|
| 145 |
*
|
| 146 |
* const oldValue = { users: [{ id: 1, name: "Alice" }], count: 1 }
|
| 147 |
* const newValue = { users: [{ id: 1, name: "Bob" }, { id: 2, name: "Charlie" }], count: 2 }
|
|
@@ -154,40 +156,38 @@ export type JsonPatch = ReadonlyArray<JsonPatchOperation>;
|
|
| 154 |
* // ]
|
| 155 |
* ```
|
| 156 |
*
|
| 157 |
-
*
|
| 158 |
-
*
|
| 159 |
-
*
|
| 160 |
-
* - {@link JsonPatchOperation} - The operation types in the patch
|
| 161 |
-
*
|
| 162 |
* @since 4.0.0
|
| 163 |
*/
|
| 164 |
export declare function get(oldValue: Schema.Json, newValue: Schema.Json): JsonPatch;
|
| 165 |
/**
|
| 166 |
-
*
|
|
|
|
|
|
|
| 167 |
*
|
| 168 |
-
*
|
|
|
|
|
|
|
| 169 |
*
|
| 170 |
-
*
|
| 171 |
*
|
| 172 |
-
*
|
| 173 |
-
*
|
| 174 |
-
*
|
| 175 |
-
*
|
|
|
|
| 176 |
*
|
| 177 |
-
*
|
| 178 |
*
|
| 179 |
-
*
|
| 180 |
-
*
|
| 181 |
-
* - Operations applied sequentially; later operations see earlier changes
|
| 182 |
-
* - Root replace (`path: ""`) returns the provided value directly
|
| 183 |
-
* - Throws errors for invalid paths, missing properties, or out-of-bounds array indices
|
| 184 |
-
* - Array operations preserve immutability by copying affected arrays
|
| 185 |
-
* - Object operations preserve immutability by copying affected objects
|
| 186 |
*
|
| 187 |
* **Example** (Applying a patch)
|
| 188 |
*
|
| 189 |
* ```ts
|
| 190 |
-
* import
|
| 191 |
*
|
| 192 |
* const document = { items: [1, 2, 3], total: 6 }
|
| 193 |
* const patch: JsonPatch.JsonPatch = [
|
|
@@ -199,11 +199,9 @@ export declare function get(oldValue: Schema.Json, newValue: Schema.Json): JsonP
|
|
| 199 |
* // { items: [1, 2, 3, 4], total: 10 }
|
| 200 |
* ```
|
| 201 |
*
|
| 202 |
-
*
|
| 203 |
-
*
|
| 204 |
-
*
|
| 205 |
-
* - {@link JsonPatchOperation} - The operation types being applied
|
| 206 |
-
*
|
| 207 |
* @since 4.0.0
|
| 208 |
*/
|
| 209 |
export declare function apply(patch: JsonPatch, oldValue: Schema.Json): Schema.Json;
|
|
|
|
| 2 |
/**
|
| 3 |
* A single JSON Patch operation.
|
| 4 |
*
|
| 5 |
+
* **When to use**
|
| 6 |
*
|
| 7 |
+
* Use to manually construct patch operations, accept patch operations from
|
| 8 |
+
* callers, or type-check patch operation structures.
|
| 9 |
*
|
| 10 |
+
* **Details**
|
|
|
|
|
|
|
| 11 |
*
|
| 12 |
+
* Represents one transformation step in a JSON Patch document. This is a subset
|
| 13 |
+
* of RFC 6902, restricted to operations that can be applied deterministically
|
| 14 |
+
* without additional context. All fields are readonly, paths use JSON Pointer
|
| 15 |
+
* syntax, and the empty string `""` refers to the root document. Operations are
|
| 16 |
+
* discriminated by the `op` field, and the optional `description` field can be
|
| 17 |
+
* used for documentation.
|
| 18 |
*
|
| 19 |
* **Example** (All operation types)
|
| 20 |
*
|
| 21 |
* ```ts
|
| 22 |
+
* import { JsonPatch } from "effect"
|
| 23 |
*
|
| 24 |
* const addOp: JsonPatch.JsonPatchOperation = {
|
| 25 |
* op: "add",
|
|
|
|
| 39 |
* }
|
| 40 |
* ```
|
| 41 |
*
|
| 42 |
+
* @see {@link JsonPatch} for the array of operations forming a complete patch
|
| 43 |
+
* @see {@link get} to compute operations automatically from value differences
|
| 44 |
+
* @see {@link apply} to apply operations to transform documents
|
| 45 |
+
* @category models
|
|
|
|
|
|
|
|
|
|
| 46 |
* @since 4.0.0
|
| 47 |
*/
|
| 48 |
export type JsonPatchOperation = {
|
| 49 |
readonly op: "add";
|
| 50 |
/**
|
| 51 |
+
* JSON Pointer to the target location. For arrays, the last token may be `-`
|
| 52 |
+
* to append.
|
| 53 |
+
*
|
| 54 |
+
* **When to use**
|
| 55 |
*
|
| 56 |
+
* Use to identify where the `add` operation inserts its value.
|
| 57 |
*/
|
| 58 |
readonly path: string;
|
| 59 |
readonly value: Schema.Json;
|
| 60 |
readonly description?: string;
|
| 61 |
} | {
|
| 62 |
readonly op: "remove";
|
| 63 |
+
/**
|
| 64 |
+
* JSON Pointer to the target location.
|
| 65 |
+
*
|
| 66 |
+
* **When to use**
|
| 67 |
+
*
|
| 68 |
+
* Use to identify which location the `remove` operation deletes.
|
| 69 |
+
*/
|
| 70 |
readonly path: string;
|
| 71 |
readonly description?: string;
|
| 72 |
} | {
|
| 73 |
readonly op: "replace";
|
| 74 |
+
/**
|
| 75 |
+
* JSON Pointer to the target location. Use `""` to replace the root document.
|
| 76 |
+
*
|
| 77 |
+
* **When to use**
|
| 78 |
+
*
|
| 79 |
+
* Use to identify which location the `replace` operation overwrites.
|
| 80 |
+
*/
|
| 81 |
readonly path: string;
|
| 82 |
readonly value: Schema.Json;
|
| 83 |
readonly description?: string;
|
|
|
|
| 85 |
/**
|
| 86 |
* A JSON Patch document (an ordered list of operations).
|
| 87 |
*
|
| 88 |
+
* **When to use**
|
|
|
|
|
|
|
| 89 |
*
|
| 90 |
+
* Use to store, serialize, pass, or validate complete patch documents.
|
|
|
|
|
|
|
|
|
|
| 91 |
*
|
| 92 |
+
* **Details**
|
| 93 |
*
|
| 94 |
+
* Represents a complete transformation as a readonly sequence of immutable
|
| 95 |
+
* operations. Operations are applied sequentially from first to last, and later
|
| 96 |
+
* operations observe the document state produced by earlier operations. An empty
|
| 97 |
+
* array represents a no-op patch and returns the original document.
|
| 98 |
*
|
| 99 |
* **Example** (Multi-operation patch)
|
| 100 |
*
|
| 101 |
* ```ts
|
| 102 |
+
* import { JsonPatch } from "effect"
|
| 103 |
*
|
| 104 |
* const patch: JsonPatch.JsonPatch = [
|
| 105 |
* { op: "add", path: "/items/-", value: "apple" },
|
|
|
|
| 111 |
* // { count: 5, items: ["apple"] }
|
| 112 |
* ```
|
| 113 |
*
|
| 114 |
+
* @see {@link JsonPatchOperation} for individual operation types
|
| 115 |
+
* @see {@link get} to generate patches from value differences
|
| 116 |
+
* @see {@link apply} to execute patches to transform documents
|
| 117 |
+
* @category models
|
|
|
|
|
|
|
|
|
|
| 118 |
* @since 4.0.0
|
| 119 |
*/
|
| 120 |
export type JsonPatch = ReadonlyArray<JsonPatchOperation>;
|
| 121 |
/**
|
| 122 |
+
* Computes a structural patch that transforms `oldValue` into `newValue`.
|
| 123 |
+
*
|
| 124 |
+
* **When to use**
|
| 125 |
*
|
| 126 |
+
* Use to compute a JSON Patch from before and after JSON documents, detect
|
| 127 |
+
* structural changes, or create deterministic update operations.
|
| 128 |
*
|
| 129 |
+
* **Details**
|
| 130 |
*
|
| 131 |
+
* Generates a structural diff between two JSON values, producing a patch that
|
| 132 |
+
* yields `newValue` when applied to `oldValue`. It returns an empty array when
|
| 133 |
+
* values are identical, recursively diffs nested structures, emits root
|
| 134 |
+
* `replace` operations for primitive changes, and processes object keys in
|
| 135 |
+
* sorted order for stable output.
|
| 136 |
*
|
| 137 |
+
* **Gotchas**
|
| 138 |
*
|
| 139 |
+
* Arrays are compared by index position, with no move or copy detection. Array
|
| 140 |
+
* removals are emitted from highest to lowest index to prevent index shifting.
|
| 141 |
+
* The output is deterministic but not guaranteed to be minimal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
*
|
| 143 |
* **Example** (Computing object diff)
|
| 144 |
*
|
| 145 |
* ```ts
|
| 146 |
+
* import { JsonPatch } from "effect"
|
| 147 |
*
|
| 148 |
* const oldValue = { users: [{ id: 1, name: "Alice" }], count: 1 }
|
| 149 |
* const newValue = { users: [{ id: 1, name: "Bob" }, { id: 2, name: "Charlie" }], count: 2 }
|
|
|
|
| 156 |
* // ]
|
| 157 |
* ```
|
| 158 |
*
|
| 159 |
+
* @see {@link apply} to apply the generated patch to a document
|
| 160 |
+
* @see {@link JsonPatchOperation} for the operation types in the patch
|
| 161 |
+
* @category transforming
|
|
|
|
|
|
|
| 162 |
* @since 4.0.0
|
| 163 |
*/
|
| 164 |
export declare function get(oldValue: Schema.Json, newValue: Schema.Json): JsonPatch;
|
| 165 |
/**
|
| 166 |
+
* Applies a JSON Patch to a JSON document.
|
| 167 |
+
*
|
| 168 |
+
* **When to use**
|
| 169 |
*
|
| 170 |
+
* Use to execute patches generated by {@link get}, transform documents
|
| 171 |
+
* with manually constructed patches, or process patch operations from external
|
| 172 |
+
* sources.
|
| 173 |
*
|
| 174 |
+
* **Details**
|
| 175 |
*
|
| 176 |
+
* Executes patch operations sequentially, so later operations see changes made
|
| 177 |
+
* by earlier operations. It never mutates the input document; array and object
|
| 178 |
+
* operations copy the affected containers. An empty patch returns the original
|
| 179 |
+
* reference, and a root replace (`path: ""`) returns the provided value
|
| 180 |
+
* directly.
|
| 181 |
*
|
| 182 |
+
* **Gotchas**
|
| 183 |
*
|
| 184 |
+
* Invalid paths, missing properties, and out-of-bounds array indices throw
|
| 185 |
+
* errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
*
|
| 187 |
* **Example** (Applying a patch)
|
| 188 |
*
|
| 189 |
* ```ts
|
| 190 |
+
* import { JsonPatch } from "effect"
|
| 191 |
*
|
| 192 |
* const document = { items: [1, 2, 3], total: 6 }
|
| 193 |
* const patch: JsonPatch.JsonPatch = [
|
|
|
|
| 199 |
* // { items: [1, 2, 3, 4], total: 10 }
|
| 200 |
* ```
|
| 201 |
*
|
| 202 |
+
* @see {@link get} to generate patches from value differences
|
| 203 |
+
* @see {@link JsonPatchOperation} for the operation types being applied
|
| 204 |
+
* @category transforming
|
|
|
|
|
|
|
| 205 |
* @since 4.0.0
|
| 206 |
*/
|
| 207 |
export declare function apply(patch: JsonPatch, oldValue: Schema.Json): Schema.Json;
|
.opencode/node_modules/effect/dist/JsonPatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonPatch.d.ts","sourceRoot":"","sources":["../src/JsonPatch.ts"],"names":[],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"JsonPatch.d.ts","sourceRoot":"","sources":["../src/JsonPatch.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACA,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAA;IAClB;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,GACC;IACA,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,GACC;IACA,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAA;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,SAAS,CA6D3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAqB1E"}
|
.opencode/node_modules/effect/dist/JsonPatch.js
CHANGED
|
@@ -1,54 +1,9 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
* - **JSON Patch**: An ordered sequence of operations that transform a document from one state to another
|
| 9 |
-
* - **JSON Pointer**: Path syntax for targeting specific locations in a JSON document (e.g., `/users/0/name`)
|
| 10 |
-
* - **Operations**: Three types - `add` (insert value), `remove` (delete value), `replace` (update value)
|
| 11 |
-
* - **Immutable transformations**: All operations return new values; inputs are never mutated
|
| 12 |
-
* - **Sequential application**: Operations are applied in order, with later operations observing changes from earlier ones
|
| 13 |
-
* - **Structural diff**: The `get` function computes differences by comparing structure, not content semantics
|
| 14 |
-
*
|
| 15 |
-
* ## Common tasks
|
| 16 |
-
*
|
| 17 |
-
* - Computing diffs between JSON values → {@link get}
|
| 18 |
-
* - Applying patches to transform documents → {@link apply}
|
| 19 |
-
* - Creating patches manually → {@link JsonPatchOperation}
|
| 20 |
-
* - Storing and validating patch documents → {@link JsonPatch}
|
| 21 |
-
*
|
| 22 |
-
* ## Gotchas
|
| 23 |
-
*
|
| 24 |
-
* - Array removals are emitted from highest index to lowest to avoid index shifting during application
|
| 25 |
-
* - Root operations use an empty string path `""` to target the entire document
|
| 26 |
-
* - Array append operations use `-` as the last token in the path (e.g., `/items/-`)
|
| 27 |
-
* - Generated patches are deterministic but not guaranteed to be minimal
|
| 28 |
-
* - Empty patches return the original document reference (no allocation)
|
| 29 |
-
* - Invalid paths or operations throw errors rather than returning a result type
|
| 30 |
-
*
|
| 31 |
-
* ## Quickstart
|
| 32 |
-
*
|
| 33 |
-
* **Example** (Computing and applying a patch)
|
| 34 |
-
*
|
| 35 |
-
* ```ts
|
| 36 |
-
* import * as JsonPatch from "effect/JsonPatch"
|
| 37 |
-
*
|
| 38 |
-
* const oldValue = { name: "Alice", age: 30 }
|
| 39 |
-
* const newValue = { name: "Alice", age: 31, city: "NYC" }
|
| 40 |
-
*
|
| 41 |
-
* const patch = JsonPatch.get(oldValue, newValue)
|
| 42 |
-
* // [{ op: "replace", path: "/age", value: 31 }, { op: "add", path: "/city", value: "NYC" }]
|
| 43 |
-
*
|
| 44 |
-
* const result = JsonPatch.apply(patch, oldValue)
|
| 45 |
-
* // { name: "Alice", age: 31, city: "NYC" }
|
| 46 |
-
* ```
|
| 47 |
-
*
|
| 48 |
-
* ## See also
|
| 49 |
-
*
|
| 50 |
-
* - {@link JsonPointer} - Utilities for working with JSON Pointer paths
|
| 51 |
-
* - {@link Schema.Json} - The JSON value type used by this module
|
| 52 |
*
|
| 53 |
* @since 4.0.0
|
| 54 |
*/
|
|
@@ -56,32 +11,31 @@ import { format } from "./Formatter.js";
|
|
| 56 |
import { escapeToken, unescapeToken } from "./JsonPointer.js";
|
| 57 |
import * as Predicate from "./Predicate.js";
|
| 58 |
/**
|
| 59 |
-
*
|
| 60 |
*
|
| 61 |
-
*
|
| 62 |
*
|
| 63 |
-
*
|
|
|
|
| 64 |
*
|
| 65 |
-
*
|
| 66 |
-
* - Detecting changes in data structures
|
| 67 |
-
* - Generating patches for synchronization or version control
|
| 68 |
-
* - Creating minimal update operations from before/after states
|
| 69 |
*
|
| 70 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
*
|
| 72 |
-
*
|
| 73 |
-
*
|
| 74 |
-
*
|
| 75 |
-
*
|
| 76 |
-
*
|
| 77 |
-
* - Array removals emitted from highest to lowest index to prevent index shifting
|
| 78 |
-
* - Output is deterministic but not guaranteed to be minimal
|
| 79 |
-
* - Nested structures are recursively diffed
|
| 80 |
*
|
| 81 |
* **Example** (Computing object diff)
|
| 82 |
*
|
| 83 |
* ```ts
|
| 84 |
-
* import
|
| 85 |
*
|
| 86 |
* const oldValue = { users: [{ id: 1, name: "Alice" }], count: 1 }
|
| 87 |
* const newValue = { users: [{ id: 1, name: "Bob" }, { id: 2, name: "Charlie" }], count: 2 }
|
|
@@ -94,11 +48,9 @@ import * as Predicate from "./Predicate.js";
|
|
| 94 |
* // ]
|
| 95 |
* ```
|
| 96 |
*
|
| 97 |
-
*
|
| 98 |
-
*
|
| 99 |
-
*
|
| 100 |
-
* - {@link JsonPatchOperation} - The operation types in the patch
|
| 101 |
-
*
|
| 102 |
* @since 4.0.0
|
| 103 |
*/
|
| 104 |
export function get(oldValue, newValue) {
|
|
@@ -172,31 +124,31 @@ export function get(oldValue, newValue) {
|
|
| 172 |
return patches;
|
| 173 |
}
|
| 174 |
/**
|
| 175 |
-
*
|
| 176 |
*
|
| 177 |
-
*
|
| 178 |
*
|
| 179 |
-
*
|
|
|
|
|
|
|
| 180 |
*
|
| 181 |
-
*
|
| 182 |
-
* - Transforming documents with manually constructed patches
|
| 183 |
-
* - Implementing patch-based update mechanisms
|
| 184 |
-
* - Processing patch operations from external sources
|
| 185 |
*
|
| 186 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
*
|
| 188 |
-
*
|
| 189 |
-
*
|
| 190 |
-
*
|
| 191 |
-
*
|
| 192 |
-
* - Throws errors for invalid paths, missing properties, or out-of-bounds array indices
|
| 193 |
-
* - Array operations preserve immutability by copying affected arrays
|
| 194 |
-
* - Object operations preserve immutability by copying affected objects
|
| 195 |
*
|
| 196 |
* **Example** (Applying a patch)
|
| 197 |
*
|
| 198 |
* ```ts
|
| 199 |
-
* import
|
| 200 |
*
|
| 201 |
* const document = { items: [1, 2, 3], total: 6 }
|
| 202 |
* const patch: JsonPatch.JsonPatch = [
|
|
@@ -208,11 +160,9 @@ export function get(oldValue, newValue) {
|
|
| 208 |
* // { items: [1, 2, 3, 4], total: 10 }
|
| 209 |
* ```
|
| 210 |
*
|
| 211 |
-
*
|
| 212 |
-
*
|
| 213 |
-
*
|
| 214 |
-
* - {@link JsonPatchOperation} - The operation types being applied
|
| 215 |
-
*
|
| 216 |
* @since 4.0.0
|
| 217 |
*/
|
| 218 |
export function apply(patch, oldValue) {
|
|
|
|
| 1 |
/**
|
| 2 |
+
* The `JsonPatch` module computes and applies deterministic patch documents for
|
| 3 |
+
* JSON values. A patch is an ordered list of `add`, `remove`, and `replace`
|
| 4 |
+
* operations addressed by JSON Pointer paths. Use it to describe the structural
|
| 5 |
+
* difference between two JSON documents, serialize that difference, and replay
|
| 6 |
+
* it without mutating the original input.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
*
|
| 8 |
* @since 4.0.0
|
| 9 |
*/
|
|
|
|
| 11 |
import { escapeToken, unescapeToken } from "./JsonPointer.js";
|
| 12 |
import * as Predicate from "./Predicate.js";
|
| 13 |
/**
|
| 14 |
+
* Computes a structural patch that transforms `oldValue` into `newValue`.
|
| 15 |
*
|
| 16 |
+
* **When to use**
|
| 17 |
*
|
| 18 |
+
* Use to compute a JSON Patch from before and after JSON documents, detect
|
| 19 |
+
* structural changes, or create deterministic update operations.
|
| 20 |
*
|
| 21 |
+
* **Details**
|
|
|
|
|
|
|
|
|
|
| 22 |
*
|
| 23 |
+
* Generates a structural diff between two JSON values, producing a patch that
|
| 24 |
+
* yields `newValue` when applied to `oldValue`. It returns an empty array when
|
| 25 |
+
* values are identical, recursively diffs nested structures, emits root
|
| 26 |
+
* `replace` operations for primitive changes, and processes object keys in
|
| 27 |
+
* sorted order for stable output.
|
| 28 |
*
|
| 29 |
+
* **Gotchas**
|
| 30 |
+
*
|
| 31 |
+
* Arrays are compared by index position, with no move or copy detection. Array
|
| 32 |
+
* removals are emitted from highest to lowest index to prevent index shifting.
|
| 33 |
+
* The output is deterministic but not guaranteed to be minimal.
|
|
|
|
|
|
|
|
|
|
| 34 |
*
|
| 35 |
* **Example** (Computing object diff)
|
| 36 |
*
|
| 37 |
* ```ts
|
| 38 |
+
* import { JsonPatch } from "effect"
|
| 39 |
*
|
| 40 |
* const oldValue = { users: [{ id: 1, name: "Alice" }], count: 1 }
|
| 41 |
* const newValue = { users: [{ id: 1, name: "Bob" }, { id: 2, name: "Charlie" }], count: 2 }
|
|
|
|
| 48 |
* // ]
|
| 49 |
* ```
|
| 50 |
*
|
| 51 |
+
* @see {@link apply} to apply the generated patch to a document
|
| 52 |
+
* @see {@link JsonPatchOperation} for the operation types in the patch
|
| 53 |
+
* @category transforming
|
|
|
|
|
|
|
| 54 |
* @since 4.0.0
|
| 55 |
*/
|
| 56 |
export function get(oldValue, newValue) {
|
|
|
|
| 124 |
return patches;
|
| 125 |
}
|
| 126 |
/**
|
| 127 |
+
* Applies a JSON Patch to a JSON document.
|
| 128 |
*
|
| 129 |
+
* **When to use**
|
| 130 |
*
|
| 131 |
+
* Use to execute patches generated by {@link get}, transform documents
|
| 132 |
+
* with manually constructed patches, or process patch operations from external
|
| 133 |
+
* sources.
|
| 134 |
*
|
| 135 |
+
* **Details**
|
|
|
|
|
|
|
|
|
|
| 136 |
*
|
| 137 |
+
* Executes patch operations sequentially, so later operations see changes made
|
| 138 |
+
* by earlier operations. It never mutates the input document; array and object
|
| 139 |
+
* operations copy the affected containers. An empty patch returns the original
|
| 140 |
+
* reference, and a root replace (`path: ""`) returns the provided value
|
| 141 |
+
* directly.
|
| 142 |
*
|
| 143 |
+
* **Gotchas**
|
| 144 |
+
*
|
| 145 |
+
* Invalid paths, missing properties, and out-of-bounds array indices throw
|
| 146 |
+
* errors.
|
|
|
|
|
|
|
|
|
|
| 147 |
*
|
| 148 |
* **Example** (Applying a patch)
|
| 149 |
*
|
| 150 |
* ```ts
|
| 151 |
+
* import { JsonPatch } from "effect"
|
| 152 |
*
|
| 153 |
* const document = { items: [1, 2, 3], total: 6 }
|
| 154 |
* const patch: JsonPatch.JsonPatch = [
|
|
|
|
| 160 |
* // { items: [1, 2, 3, 4], total: 10 }
|
| 161 |
* ```
|
| 162 |
*
|
| 163 |
+
* @see {@link get} to generate patches from value differences
|
| 164 |
+
* @see {@link JsonPatchOperation} for the operation types being applied
|
| 165 |
+
* @category transforming
|
|
|
|
|
|
|
| 166 |
* @since 4.0.0
|
| 167 |
*/
|
| 168 |
export function apply(patch, oldValue) {
|
.opencode/node_modules/effect/dist/JsonPatch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonPatch.js","names":["format","escapeToken","unescapeToken","Predicate","get","oldValue","newValue","Object","is","patches","Array","isArray","len1","length","len2","shared","Math","min","i","path","patch","op","prefixPathInPlace","push","value","isJsonObject","keys1","keys","keys2","allKeys","from","Set","sort","key","esc","hasKey1","hasOwn","hasKey2","apply","doc","setAt","addAt","undefined","parent","isObject","tokenize","pointer","charCodeAt","Error","split","slice","map","toIndex","token","test","Number","val","resolved","resolveParent","lastToken","stack","idx","updated","splice","rebuildFromStack","mode","tokens","cur","container","newParent","acc","copy"],"sources":["../src/JsonPatch.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"JsonPatch.js","names":["format","escapeToken","unescapeToken","Predicate","get","oldValue","newValue","Object","is","patches","Array","isArray","len1","length","len2","shared","Math","min","i","path","patch","op","prefixPathInPlace","push","value","isJsonObject","keys1","keys","keys2","allKeys","from","Set","sort","key","esc","hasKey1","hasOwn","hasKey2","apply","doc","setAt","addAt","undefined","parent","isObject","tokenize","pointer","charCodeAt","Error","split","slice","map","toIndex","token","test","Number","val","resolved","resolveParent","lastToken","stack","idx","updated","splice","rebuildFromStack","mode","tokens","cur","container","newParent","acc","copy"],"sources":["../src/JsonPatch.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,WAAW,EAAEC,aAAa,QAAQ,kBAAkB;AAC7D,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AA+H3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,OAAM,SAAUC,GAAGA,CAACC,QAAqB,EAAEC,QAAqB;EAC9D,IAAIC,MAAM,CAACC,EAAE,CAACH,QAAQ,EAAEC,QAAQ,CAAC,EAAE,OAAO,EAAE;EAC5C,MAAMG,OAAO,GAA8B,EAAE;EAE7C,IAAIC,KAAK,CAACC,OAAO,CAACN,QAAQ,CAAC,IAAIK,KAAK,CAACC,OAAO,CAACL,QAAQ,CAAC,EAAE;IACtD,MAAMM,IAAI,GAAGP,QAAQ,CAACQ,MAAM;IAC5B,MAAMC,IAAI,GAAGR,QAAQ,CAACO,MAAM;IAE5B;IACA,MAAME,MAAM,GAAGC,IAAI,CAACC,GAAG,CAACL,IAAI,EAAEE,IAAI,CAAC;IACnC,KAAK,IAAII,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,MAAM,EAAEG,CAAC,EAAE,EAAE;MAC/B,MAAMC,IAAI,GAAG,IAAID,CAAC,EAAE;MACpB,MAAME,KAAK,GAAGhB,GAAG,CAACC,QAAQ,CAACa,CAAC,CAAC,EAAEZ,QAAQ,CAACY,CAAC,CAAC,CAAC;MAC3C,KAAK,MAAMG,EAAE,IAAID,KAAK,EAAE;QACtBE,iBAAiB,CAACD,EAAE,EAAEF,IAAI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GAAG,EAAEd,KAAK,CAAC,EAAE,OAAO,IAAI;MAC3CO,KAAK,CAACrC,IAAI,CAAC;QAAE6C,SAAS,EAAED,GAAG;QAAEd;MAAK,CAAE,CAAC;MACrCc,GAAG,GAAIA,GAAW,CAACd,KAAK,CAAC;MACzB;IACF;IAEA,OAAO,IAAI;EACb;EAEA,OAAO;IAAEO,KAAK;IAAEjB,MAAM,EAAEwB,GAAG;IAAER;EAAS,CAAE;AAC1C;AAEA;AACA,SAASK,gBAAgBA,CAACJ,KAAgC,EAAES,SAAsB;EAChF,IAAIC,GAAG,GAAgBD,SAAS;EAEhC,KAAK,IAAInD,CAAC,GAAG0C,KAAK,CAAC/C,MAAM,GAAG,CAAC,EAAEK,CAAC,IAAI,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1C,MAAM;MAAEkD,SAAS;MAAEf;IAAK,CAAE,GAAGO,KAAK,CAAC1C,CAAC,CAAC;IAErC,IAAIR,KAAK,CAACC,OAAO,CAACyD,SAAS,CAAC,EAAE;MAC5B,MAAMG,IAAI,GAAGH,SAAS,CAAClB,KAAK,EAAE;MAC9BqB,IAAI,CAAClB,KAAe,CAAC,GAAGiB,GAAG;MAC3BA,GAAG,GAAGC,IAAI;IACZ,CAAC,MAAM;MACL,MAAMA,IAAI,GAAG;QAAE,GAAIH;MAA+B,CAAE;MACpDG,IAAI,CAAClB,KAAe,CAAC,GAAGiB,GAAG;MAC3BA,GAAG,GAAGC,IAAI;IACZ;EACF;EAEA,OAAOD,GAAG;AACZ","ignoreList":[]}
|
.opencode/node_modules/effect/dist/JsonPointer.d.ts
CHANGED
|
@@ -1,125 +1,74 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
* must be escaped when it contains special characters (`~` or `/`).
|
| 7 |
-
*
|
| 8 |
-
* ## Mental model
|
| 9 |
-
*
|
| 10 |
-
* - **Reference token**: A single segment of a JSON Pointer path (e.g., `"foo"`, `"bar/baz"`, `"key~with~tilde"`)
|
| 11 |
-
* - **Escaping**: Encoding special characters in a token so it can be safely used in a JSON Pointer (`~` → `~0`, `/` → `~1`)
|
| 12 |
-
* - **Unescaping**: Decoding escaped characters back to their original form (`~0` → `~`, `~1` → `/`)
|
| 13 |
-
* - **RFC 6901 compliance**: These functions implement the standard escaping rules for JSON Pointer reference tokens
|
| 14 |
-
* - **Pure functions**: Both operations are pure, immutable, and have no side effects
|
| 15 |
-
*
|
| 16 |
-
* ## Common tasks
|
| 17 |
-
*
|
| 18 |
-
* - Building JSON Pointers from path segments → {@link escapeToken}
|
| 19 |
-
* - Parsing JSON Pointers to extract original token values → {@link unescapeToken}
|
| 20 |
-
* - Escaping object keys or path segments before constructing JSON Pointers → {@link escapeToken}
|
| 21 |
-
* - Extracting unescaped identifiers from JSON Pointer strings → {@link unescapeToken}
|
| 22 |
-
*
|
| 23 |
-
* ## Gotchas
|
| 24 |
-
*
|
| 25 |
-
* - These functions operate on **reference tokens**, not full JSON Pointers. A full JSON Pointer like `/foo/bar` must be split into tokens (`["foo", "bar"]`) before escaping/unescaping
|
| 26 |
-
* - The order of replacement operations matters: `escapeToken` replaces `~` before `/` to avoid double-escaping
|
| 27 |
-
* - Empty strings are valid tokens and are returned unchanged
|
| 28 |
-
* - These functions do not validate JSON Pointer syntax; they only handle token-level escaping
|
| 29 |
-
*
|
| 30 |
-
* ## Quickstart
|
| 31 |
-
*
|
| 32 |
-
* **Example** (Building and parsing a JSON Pointer)
|
| 33 |
-
*
|
| 34 |
-
* ```ts
|
| 35 |
-
* import { escapeToken, unescapeToken } from "effect/JsonPointer"
|
| 36 |
-
*
|
| 37 |
-
* // Build a JSON Pointer from path segments
|
| 38 |
-
* const segments = ["users", "name/alias", "value"]
|
| 39 |
-
* const pointer = "/" + segments.map(escapeToken).join("/")
|
| 40 |
-
* // "/users/name~1alias/value"
|
| 41 |
-
*
|
| 42 |
-
* // Parse a JSON Pointer back to segments
|
| 43 |
-
* const tokens = pointer.split("/").slice(1).map(unescapeToken)
|
| 44 |
-
* // ["users", "name/alias", "value"]
|
| 45 |
-
* ```
|
| 46 |
-
*
|
| 47 |
-
* ## See also
|
| 48 |
-
*
|
| 49 |
-
* - {@link JsonPatch} - Uses these utilities for JSON Patch operations
|
| 50 |
-
* - {@link JsonSchema} - Uses these utilities for schema reference resolution
|
| 51 |
*
|
| 52 |
* @since 4.0.0
|
| 53 |
*/
|
| 54 |
/**
|
| 55 |
-
* Escapes a JSON Pointer reference token according to RFC 6901.
|
| 56 |
-
*
|
| 57 |
-
* Encodes special characters in a reference token so it can be safely used as a segment in a JSON Pointer.
|
| 58 |
*
|
| 59 |
-
*
|
| 60 |
*
|
| 61 |
-
*
|
| 62 |
-
* - Escaping tokens before joining them with `/` to form a complete JSON Pointer
|
| 63 |
-
* - Preparing reference tokens for use in JSON Patch operations or schema references
|
| 64 |
*
|
| 65 |
-
*
|
| 66 |
*
|
| 67 |
-
* -
|
| 68 |
* - Replaces `~` (tilde) with `~0` and `/` (forward slash) with `~1`
|
| 69 |
-
* - Replacement order matters: `~` is replaced before `/` to prevent double-escaping
|
| 70 |
* - Returns the input unchanged if it contains no special characters
|
| 71 |
* - Empty strings are valid and returned unchanged
|
| 72 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
* **Example** (Escaping special characters)
|
| 74 |
*
|
| 75 |
* ```ts
|
| 76 |
-
* import {
|
| 77 |
*
|
| 78 |
-
* escapeToken("a/b") // "a~1b"
|
| 79 |
-
* escapeToken("c~d") // "c~0d"
|
| 80 |
-
* escapeToken("path/to~key") // "path~1to~0key"
|
| 81 |
* ```
|
| 82 |
*
|
| 83 |
-
*
|
| 84 |
-
*
|
| 85 |
-
* - {@link unescapeToken} - The inverse operation for decoding escaped tokens
|
| 86 |
-
*
|
| 87 |
* @since 4.0.0
|
| 88 |
*/
|
| 89 |
export declare function escapeToken(token: string): string;
|
| 90 |
/**
|
| 91 |
-
*
|
| 92 |
-
*
|
| 93 |
-
* Decodes escaped characters in a reference token to recover the original token value.
|
| 94 |
*
|
| 95 |
-
*
|
| 96 |
*
|
| 97 |
-
*
|
| 98 |
-
* - Converting escaped tokens back to their original form for use as object keys or identifiers
|
| 99 |
-
* - Resolving schema references or JSON Patch paths that use escaped tokens
|
| 100 |
*
|
| 101 |
-
*
|
| 102 |
*
|
| 103 |
-
* -
|
| 104 |
* - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)
|
| 105 |
-
* - Replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding
|
| 106 |
* - Returns the input unchanged if it contains no escaped sequences
|
| 107 |
* - Empty strings are valid and returned unchanged
|
| 108 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
* **Example** (Unescaping special characters)
|
| 110 |
*
|
| 111 |
* ```ts
|
| 112 |
-
* import {
|
| 113 |
*
|
| 114 |
-
* unescapeToken("a~1b") // "a/b"
|
| 115 |
-
* unescapeToken("c~0d") // "c~d"
|
| 116 |
-
* unescapeToken("path~1to~0key") // "path/to~key"
|
| 117 |
* ```
|
| 118 |
*
|
| 119 |
-
*
|
| 120 |
-
*
|
| 121 |
-
* - {@link escapeToken} - The inverse operation for encoding tokens
|
| 122 |
-
*
|
| 123 |
* @since 4.0.0
|
| 124 |
*/
|
| 125 |
export declare function unescapeToken(token: string): string;
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Helpers for escaping and unescaping JSON Pointer path segments. JSON Pointer
|
| 3 |
+
* uses `/` to separate path tokens inside a JSON document, so token text must
|
| 4 |
+
* encode literal `~` and `/` characters. This module provides the two RFC 6901
|
| 5 |
+
* token conversions used by JSON Patch and related path handling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
*
|
| 7 |
* @since 4.0.0
|
| 8 |
*/
|
| 9 |
/**
|
| 10 |
+
* Escapes a JSON Pointer reference token according to RFC 6901 by encoding special characters so the token can be safely used as a segment in a JSON Pointer.
|
|
|
|
|
|
|
| 11 |
*
|
| 12 |
+
* **When to use**
|
| 13 |
*
|
| 14 |
+
* Use when you need to escape a single JSON Pointer path segment.
|
|
|
|
|
|
|
| 15 |
*
|
| 16 |
+
* **Details**
|
| 17 |
*
|
| 18 |
+
* - Returns a new escaped string
|
| 19 |
* - Replaces `~` (tilde) with `~0` and `/` (forward slash) with `~1`
|
|
|
|
| 20 |
* - Returns the input unchanged if it contains no special characters
|
| 21 |
* - Empty strings are valid and returned unchanged
|
| 22 |
*
|
| 23 |
+
* **Gotchas**
|
| 24 |
+
*
|
| 25 |
+
* The replacement order matters: `~` is replaced before `/` to prevent double-escaping.
|
| 26 |
+
*
|
| 27 |
* **Example** (Escaping special characters)
|
| 28 |
*
|
| 29 |
* ```ts
|
| 30 |
+
* import { JsonPointer } from "effect"
|
| 31 |
*
|
| 32 |
+
* JsonPointer.escapeToken("a/b") // "a~1b"
|
| 33 |
+
* JsonPointer.escapeToken("c~d") // "c~0d"
|
| 34 |
+
* JsonPointer.escapeToken("path/to~key") // "path~1to~0key"
|
| 35 |
* ```
|
| 36 |
*
|
| 37 |
+
* @see {@link unescapeToken} The inverse operation for decoding escaped tokens
|
| 38 |
+
* @category encoding
|
|
|
|
|
|
|
| 39 |
* @since 4.0.0
|
| 40 |
*/
|
| 41 |
export declare function escapeToken(token: string): string;
|
| 42 |
/**
|
| 43 |
+
* Decodes a JSON Pointer reference token according to RFC 6901 escaping rules.
|
|
|
|
|
|
|
| 44 |
*
|
| 45 |
+
* **When to use**
|
| 46 |
*
|
| 47 |
+
* Use when you need to decode a single escaped JSON Pointer path segment.
|
|
|
|
|
|
|
| 48 |
*
|
| 49 |
+
* **Details**
|
| 50 |
*
|
| 51 |
+
* - Returns a new unescaped string
|
| 52 |
* - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)
|
|
|
|
| 53 |
* - Returns the input unchanged if it contains no escaped sequences
|
| 54 |
* - Empty strings are valid and returned unchanged
|
| 55 |
*
|
| 56 |
+
* **Gotchas**
|
| 57 |
+
*
|
| 58 |
+
* The replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding.
|
| 59 |
+
*
|
| 60 |
* **Example** (Unescaping special characters)
|
| 61 |
*
|
| 62 |
* ```ts
|
| 63 |
+
* import { JsonPointer } from "effect"
|
| 64 |
*
|
| 65 |
+
* JsonPointer.unescapeToken("a~1b") // "a/b"
|
| 66 |
+
* JsonPointer.unescapeToken("c~0d") // "c~d"
|
| 67 |
+
* JsonPointer.unescapeToken("path~1to~0key") // "path/to~key"
|
| 68 |
* ```
|
| 69 |
*
|
| 70 |
+
* @see {@link escapeToken} The inverse operation for encoding tokens
|
| 71 |
+
* @category decoding
|
|
|
|
|
|
|
| 72 |
* @since 4.0.0
|
| 73 |
*/
|
| 74 |
export declare function unescapeToken(token: string): string;
|
.opencode/node_modules/effect/dist/JsonPointer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonPointer.d.ts","sourceRoot":"","sources":["../src/JsonPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"JsonPointer.d.ts","sourceRoot":"","sources":["../src/JsonPointer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
.opencode/node_modules/effect/dist/JsonPointer.js
CHANGED
|
@@ -1,127 +1,76 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
* must be escaped when it contains special characters (`~` or `/`).
|
| 7 |
-
*
|
| 8 |
-
* ## Mental model
|
| 9 |
-
*
|
| 10 |
-
* - **Reference token**: A single segment of a JSON Pointer path (e.g., `"foo"`, `"bar/baz"`, `"key~with~tilde"`)
|
| 11 |
-
* - **Escaping**: Encoding special characters in a token so it can be safely used in a JSON Pointer (`~` → `~0`, `/` → `~1`)
|
| 12 |
-
* - **Unescaping**: Decoding escaped characters back to their original form (`~0` → `~`, `~1` → `/`)
|
| 13 |
-
* - **RFC 6901 compliance**: These functions implement the standard escaping rules for JSON Pointer reference tokens
|
| 14 |
-
* - **Pure functions**: Both operations are pure, immutable, and have no side effects
|
| 15 |
-
*
|
| 16 |
-
* ## Common tasks
|
| 17 |
-
*
|
| 18 |
-
* - Building JSON Pointers from path segments → {@link escapeToken}
|
| 19 |
-
* - Parsing JSON Pointers to extract original token values → {@link unescapeToken}
|
| 20 |
-
* - Escaping object keys or path segments before constructing JSON Pointers → {@link escapeToken}
|
| 21 |
-
* - Extracting unescaped identifiers from JSON Pointer strings → {@link unescapeToken}
|
| 22 |
-
*
|
| 23 |
-
* ## Gotchas
|
| 24 |
-
*
|
| 25 |
-
* - These functions operate on **reference tokens**, not full JSON Pointers. A full JSON Pointer like `/foo/bar` must be split into tokens (`["foo", "bar"]`) before escaping/unescaping
|
| 26 |
-
* - The order of replacement operations matters: `escapeToken` replaces `~` before `/` to avoid double-escaping
|
| 27 |
-
* - Empty strings are valid tokens and are returned unchanged
|
| 28 |
-
* - These functions do not validate JSON Pointer syntax; they only handle token-level escaping
|
| 29 |
-
*
|
| 30 |
-
* ## Quickstart
|
| 31 |
-
*
|
| 32 |
-
* **Example** (Building and parsing a JSON Pointer)
|
| 33 |
-
*
|
| 34 |
-
* ```ts
|
| 35 |
-
* import { escapeToken, unescapeToken } from "effect/JsonPointer"
|
| 36 |
-
*
|
| 37 |
-
* // Build a JSON Pointer from path segments
|
| 38 |
-
* const segments = ["users", "name/alias", "value"]
|
| 39 |
-
* const pointer = "/" + segments.map(escapeToken).join("/")
|
| 40 |
-
* // "/users/name~1alias/value"
|
| 41 |
-
*
|
| 42 |
-
* // Parse a JSON Pointer back to segments
|
| 43 |
-
* const tokens = pointer.split("/").slice(1).map(unescapeToken)
|
| 44 |
-
* // ["users", "name/alias", "value"]
|
| 45 |
-
* ```
|
| 46 |
-
*
|
| 47 |
-
* ## See also
|
| 48 |
-
*
|
| 49 |
-
* - {@link JsonPatch} - Uses these utilities for JSON Patch operations
|
| 50 |
-
* - {@link JsonSchema} - Uses these utilities for schema reference resolution
|
| 51 |
*
|
| 52 |
* @since 4.0.0
|
| 53 |
*/
|
| 54 |
/**
|
| 55 |
-
* Escapes a JSON Pointer reference token according to RFC 6901.
|
| 56 |
-
*
|
| 57 |
-
* Encodes special characters in a reference token so it can be safely used as a segment in a JSON Pointer.
|
| 58 |
*
|
| 59 |
-
*
|
| 60 |
*
|
| 61 |
-
*
|
| 62 |
-
* - Escaping tokens before joining them with `/` to form a complete JSON Pointer
|
| 63 |
-
* - Preparing reference tokens for use in JSON Patch operations or schema references
|
| 64 |
*
|
| 65 |
-
*
|
| 66 |
*
|
| 67 |
-
* -
|
| 68 |
* - Replaces `~` (tilde) with `~0` and `/` (forward slash) with `~1`
|
| 69 |
-
* - Replacement order matters: `~` is replaced before `/` to prevent double-escaping
|
| 70 |
* - Returns the input unchanged if it contains no special characters
|
| 71 |
* - Empty strings are valid and returned unchanged
|
| 72 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
* **Example** (Escaping special characters)
|
| 74 |
*
|
| 75 |
* ```ts
|
| 76 |
-
* import {
|
| 77 |
*
|
| 78 |
-
* escapeToken("a/b") // "a~1b"
|
| 79 |
-
* escapeToken("c~d") // "c~0d"
|
| 80 |
-
* escapeToken("path/to~key") // "path~1to~0key"
|
| 81 |
* ```
|
| 82 |
*
|
| 83 |
-
*
|
| 84 |
-
*
|
| 85 |
-
* - {@link unescapeToken} - The inverse operation for decoding escaped tokens
|
| 86 |
-
*
|
| 87 |
* @since 4.0.0
|
| 88 |
*/
|
| 89 |
export function escapeToken(token) {
|
| 90 |
return token.replace(/~/g, "~0").replace(/\//g, "~1");
|
| 91 |
}
|
| 92 |
/**
|
| 93 |
-
*
|
| 94 |
-
*
|
| 95 |
-
* Decodes escaped characters in a reference token to recover the original token value.
|
| 96 |
*
|
| 97 |
-
*
|
| 98 |
*
|
| 99 |
-
*
|
| 100 |
-
* - Converting escaped tokens back to their original form for use as object keys or identifiers
|
| 101 |
-
* - Resolving schema references or JSON Patch paths that use escaped tokens
|
| 102 |
*
|
| 103 |
-
*
|
| 104 |
*
|
| 105 |
-
* -
|
| 106 |
* - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)
|
| 107 |
-
* - Replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding
|
| 108 |
* - Returns the input unchanged if it contains no escaped sequences
|
| 109 |
* - Empty strings are valid and returned unchanged
|
| 110 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
* **Example** (Unescaping special characters)
|
| 112 |
*
|
| 113 |
* ```ts
|
| 114 |
-
* import {
|
| 115 |
*
|
| 116 |
-
* unescapeToken("a~1b") // "a/b"
|
| 117 |
-
* unescapeToken("c~0d") // "c~d"
|
| 118 |
-
* unescapeToken("path~1to~0key") // "path/to~key"
|
| 119 |
* ```
|
| 120 |
*
|
| 121 |
-
*
|
| 122 |
-
*
|
| 123 |
-
* - {@link escapeToken} - The inverse operation for encoding tokens
|
| 124 |
-
*
|
| 125 |
* @since 4.0.0
|
| 126 |
*/
|
| 127 |
export function unescapeToken(token) {
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Helpers for escaping and unescaping JSON Pointer path segments. JSON Pointer
|
| 3 |
+
* uses `/` to separate path tokens inside a JSON document, so token text must
|
| 4 |
+
* encode literal `~` and `/` characters. This module provides the two RFC 6901
|
| 5 |
+
* token conversions used by JSON Patch and related path handling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
*
|
| 7 |
* @since 4.0.0
|
| 8 |
*/
|
| 9 |
/**
|
| 10 |
+
* Escapes a JSON Pointer reference token according to RFC 6901 by encoding special characters so the token can be safely used as a segment in a JSON Pointer.
|
|
|
|
|
|
|
| 11 |
*
|
| 12 |
+
* **When to use**
|
| 13 |
*
|
| 14 |
+
* Use when you need to escape a single JSON Pointer path segment.
|
|
|
|
|
|
|
| 15 |
*
|
| 16 |
+
* **Details**
|
| 17 |
*
|
| 18 |
+
* - Returns a new escaped string
|
| 19 |
* - Replaces `~` (tilde) with `~0` and `/` (forward slash) with `~1`
|
|
|
|
| 20 |
* - Returns the input unchanged if it contains no special characters
|
| 21 |
* - Empty strings are valid and returned unchanged
|
| 22 |
*
|
| 23 |
+
* **Gotchas**
|
| 24 |
+
*
|
| 25 |
+
* The replacement order matters: `~` is replaced before `/` to prevent double-escaping.
|
| 26 |
+
*
|
| 27 |
* **Example** (Escaping special characters)
|
| 28 |
*
|
| 29 |
* ```ts
|
| 30 |
+
* import { JsonPointer } from "effect"
|
| 31 |
*
|
| 32 |
+
* JsonPointer.escapeToken("a/b") // "a~1b"
|
| 33 |
+
* JsonPointer.escapeToken("c~d") // "c~0d"
|
| 34 |
+
* JsonPointer.escapeToken("path/to~key") // "path~1to~0key"
|
| 35 |
* ```
|
| 36 |
*
|
| 37 |
+
* @see {@link unescapeToken} The inverse operation for decoding escaped tokens
|
| 38 |
+
* @category encoding
|
|
|
|
|
|
|
| 39 |
* @since 4.0.0
|
| 40 |
*/
|
| 41 |
export function escapeToken(token) {
|
| 42 |
return token.replace(/~/g, "~0").replace(/\//g, "~1");
|
| 43 |
}
|
| 44 |
/**
|
| 45 |
+
* Decodes a JSON Pointer reference token according to RFC 6901 escaping rules.
|
|
|
|
|
|
|
| 46 |
*
|
| 47 |
+
* **When to use**
|
| 48 |
*
|
| 49 |
+
* Use when you need to decode a single escaped JSON Pointer path segment.
|
|
|
|
|
|
|
| 50 |
*
|
| 51 |
+
* **Details**
|
| 52 |
*
|
| 53 |
+
* - Returns a new unescaped string
|
| 54 |
* - Replaces `~1` with `/` (forward slash) and `~0` with `~` (tilde)
|
|
|
|
| 55 |
* - Returns the input unchanged if it contains no escaped sequences
|
| 56 |
* - Empty strings are valid and returned unchanged
|
| 57 |
*
|
| 58 |
+
* **Gotchas**
|
| 59 |
+
*
|
| 60 |
+
* The replacement order matters: `~1` is replaced before `~0` to prevent incorrect decoding.
|
| 61 |
+
*
|
| 62 |
* **Example** (Unescaping special characters)
|
| 63 |
*
|
| 64 |
* ```ts
|
| 65 |
+
* import { JsonPointer } from "effect"
|
| 66 |
*
|
| 67 |
+
* JsonPointer.unescapeToken("a~1b") // "a/b"
|
| 68 |
+
* JsonPointer.unescapeToken("c~0d") // "c~d"
|
| 69 |
+
* JsonPointer.unescapeToken("path~1to~0key") // "path/to~key"
|
| 70 |
* ```
|
| 71 |
*
|
| 72 |
+
* @see {@link escapeToken} The inverse operation for encoding tokens
|
| 73 |
+
* @category decoding
|
|
|
|
|
|
|
| 74 |
* @since 4.0.0
|
| 75 |
*/
|
| 76 |
export function unescapeToken(token) {
|
.opencode/node_modules/effect/dist/JsonPointer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonPointer.js","names":["escapeToken","token","replace","unescapeToken"],"sources":["../src/JsonPointer.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
| 1 |
+
{"version":3,"file":"JsonPointer.js","names":["escapeToken","token","replace","unescapeToken"],"sources":["../src/JsonPointer.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,OAAM,SAAUA,WAAWA,CAACC,KAAa;EACvC,OAAOA,KAAK,CAACC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;AACvD;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,OAAM,SAAUC,aAAaA,CAACF,KAAa;EACzC,OAAOA,KAAK,CAACC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAACA,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;AACtD","ignoreList":[]}
|
.opencode/node_modules/effect/dist/JsonSchema.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
| 1 |
/**
|
| 2 |
* A plain object representing a single JSON Schema node.
|
| 3 |
*
|
| 4 |
-
*
|
| 5 |
-
* JSON Schema keyword. Most functions in this module accept or return this
|
| 6 |
-
* type.
|
| 7 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
* @since 4.0.0
|
| 9 |
*/
|
| 10 |
export interface JsonSchema {
|
|
@@ -13,23 +19,53 @@ export interface JsonSchema {
|
|
| 13 |
/**
|
| 14 |
* The set of JSON Schema dialects supported by this module.
|
| 15 |
*
|
| 16 |
-
*
|
| 17 |
-
*
|
| 18 |
-
*
|
| 19 |
-
*
|
|
|
|
|
|
|
| 20 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
* @since 4.0.0
|
| 22 |
*/
|
| 23 |
export type Dialect = "draft-07" | "draft-2020-12" | "openapi-3.1" | "openapi-3.0";
|
| 24 |
/**
|
| 25 |
* The JSON Schema primitive type names.
|
| 26 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
* @since 4.0.0
|
| 28 |
*/
|
| 29 |
export type Type = "string" | "number" | "boolean" | "array" | "object" | "null" | "integer";
|
| 30 |
/**
|
| 31 |
* A record of named JSON Schema definitions, keyed by definition name.
|
| 32 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
* @since 4.0.0
|
| 34 |
*/
|
| 35 |
export interface Definitions extends Record<string, JsonSchema> {
|
|
@@ -38,16 +74,19 @@ export interface Definitions extends Record<string, JsonSchema> {
|
|
| 38 |
* A structured container for a single JSON Schema and its associated
|
| 39 |
* definitions.
|
| 40 |
*
|
| 41 |
-
*
|
| 42 |
-
*
|
| 43 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
*
|
| 45 |
* The `schema` field holds the root schema *without* the definitions
|
| 46 |
* collection. Root definitions are stored separately in `definitions` and
|
| 47 |
-
* referenced via
|
| 48 |
-
* - `#/
|
| 49 |
-
*
|
| 50 |
-
* - `#/components/schemas/<name>` for OpenAPI 3.1 and OpenAPI 3.0
|
| 51 |
*
|
| 52 |
* **Example** (Inspecting a parsed document)
|
| 53 |
*
|
|
@@ -68,7 +107,7 @@ export interface Definitions extends Record<string, JsonSchema> {
|
|
| 68 |
*
|
| 69 |
* @see {@link MultiDocument}
|
| 70 |
* @see {@link fromSchemaDraft2020_12}
|
| 71 |
-
*
|
| 72 |
* @since 4.0.0
|
| 73 |
*/
|
| 74 |
export interface Document<D extends Dialect> {
|
|
@@ -78,15 +117,20 @@ export interface Document<D extends Dialect> {
|
|
| 78 |
}
|
| 79 |
/**
|
| 80 |
* Like {@link Document}, but carries multiple root schemas that share a
|
| 81 |
-
* single definitions pool.
|
| 82 |
-
*
|
|
|
|
| 83 |
*
|
| 84 |
-
*
|
| 85 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
*
|
| 87 |
* @see {@link Document}
|
| 88 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 89 |
-
*
|
| 90 |
* @since 4.0.0
|
| 91 |
*/
|
| 92 |
export interface MultiDocument<D extends Dialect> {
|
|
@@ -95,27 +139,61 @@ export interface MultiDocument<D extends Dialect> {
|
|
| 95 |
readonly definitions: Definitions;
|
| 96 |
}
|
| 97 |
/**
|
| 98 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
* @since 4.0.0
|
| 101 |
*/
|
| 102 |
export declare const META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema";
|
| 103 |
/**
|
| 104 |
-
*
|
|
|
|
|
|
|
| 105 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
* @since 4.0.0
|
| 107 |
*/
|
| 108 |
export declare const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
| 109 |
/**
|
| 110 |
* Parses a raw Draft-07 JSON Schema into a `Document<"draft-2020-12">`.
|
| 111 |
*
|
| 112 |
-
*
|
| 113 |
-
*
|
| 114 |
-
*
|
| 115 |
-
*
|
| 116 |
-
*
|
| 117 |
-
*
|
| 118 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
*
|
| 120 |
* **Example** (Parsing a Draft-07 schema)
|
| 121 |
*
|
|
@@ -140,17 +218,21 @@ export declare const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/dr
|
|
| 140 |
* @see {@link fromSchemaDraft2020_12}
|
| 141 |
* @see {@link fromSchemaOpenApi3_0}
|
| 142 |
* @see {@link toDocumentDraft07}
|
| 143 |
-
*
|
| 144 |
* @since 4.0.0
|
| 145 |
*/
|
| 146 |
export declare function fromSchemaDraft07(js: JsonSchema): Document<"draft-2020-12">;
|
| 147 |
/**
|
| 148 |
* Parses a raw Draft-2020-12 JSON Schema into a `Document<"draft-2020-12">`.
|
| 149 |
*
|
| 150 |
-
*
|
| 151 |
-
*
|
| 152 |
-
*
|
| 153 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
*
|
| 155 |
* **Example** (Parsing a Draft-2020-12 schema)
|
| 156 |
*
|
|
@@ -170,17 +252,22 @@ export declare function fromSchemaDraft07(js: JsonSchema): Document<"draft-2020-
|
|
| 170 |
*
|
| 171 |
* @see {@link fromSchemaDraft07}
|
| 172 |
* @see {@link fromSchemaOpenApi3_1}
|
| 173 |
-
*
|
| 174 |
* @since 4.0.0
|
| 175 |
*/
|
| 176 |
export declare function fromSchemaDraft2020_12(js: JsonSchema): Document<"draft-2020-12">;
|
| 177 |
/**
|
| 178 |
* Parses a raw OpenAPI 3.1 JSON Schema into a `Document<"draft-2020-12">`.
|
| 179 |
*
|
| 180 |
-
*
|
| 181 |
-
*
|
| 182 |
-
*
|
| 183 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
*
|
| 185 |
* **Example** (Parsing an OpenAPI 3.1 schema)
|
| 186 |
*
|
|
@@ -201,19 +288,24 @@ export declare function fromSchemaDraft2020_12(js: JsonSchema): Document<"draft-
|
|
| 201 |
*
|
| 202 |
* @see {@link fromSchemaOpenApi3_0}
|
| 203 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 204 |
-
*
|
| 205 |
* @since 4.0.0
|
| 206 |
*/
|
| 207 |
export declare function fromSchemaOpenApi3_1(js: JsonSchema): Document<"draft-2020-12">;
|
| 208 |
/**
|
| 209 |
* Parses a raw OpenAPI 3.0 JSON Schema into a `Document<"draft-2020-12">`.
|
| 210 |
*
|
| 211 |
-
*
|
| 212 |
-
*
|
| 213 |
-
*
|
| 214 |
-
*
|
| 215 |
-
*
|
| 216 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
*
|
| 218 |
* **Example** (Parsing an OpenAPI 3.0 nullable schema)
|
| 219 |
*
|
|
@@ -232,20 +324,28 @@ export declare function fromSchemaOpenApi3_1(js: JsonSchema): Document<"draft-20
|
|
| 232 |
*
|
| 233 |
* @see {@link fromSchemaOpenApi3_1}
|
| 234 |
* @see {@link fromSchemaDraft07}
|
| 235 |
-
*
|
| 236 |
* @since 4.0.0
|
| 237 |
*/
|
| 238 |
export declare function fromSchemaOpenApi3_0(schema: JsonSchema): Document<"draft-2020-12">;
|
| 239 |
/**
|
| 240 |
* Converts a `Document<"draft-2020-12">` to a `Document<"draft-07">`.
|
| 241 |
*
|
| 242 |
-
*
|
| 243 |
-
*
|
| 244 |
-
*
|
| 245 |
-
*
|
| 246 |
-
*
|
| 247 |
-
*
|
| 248 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
*
|
| 250 |
* **Example** (Converting to Draft-07)
|
| 251 |
*
|
|
@@ -266,7 +366,7 @@ export declare function fromSchemaOpenApi3_0(schema: JsonSchema): Document<"draf
|
|
| 266 |
*
|
| 267 |
* @see {@link fromSchemaDraft07}
|
| 268 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 269 |
-
*
|
| 270 |
* @since 4.0.0
|
| 271 |
*/
|
| 272 |
export declare function toDocumentDraft07(document: Document<"draft-2020-12">): Document<"draft-07">;
|
|
@@ -274,13 +374,18 @@ export declare function toDocumentDraft07(document: Document<"draft-2020-12">):
|
|
| 274 |
* Converts a `MultiDocument<"draft-2020-12">` to a
|
| 275 |
* `MultiDocument<"openapi-3.1">`.
|
| 276 |
*
|
| 277 |
-
*
|
| 278 |
-
*
|
| 279 |
-
*
|
| 280 |
-
*
|
| 281 |
-
*
|
| 282 |
-
*
|
| 283 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
*
|
| 285 |
* **Example** (Converting to OpenAPI 3.1)
|
| 286 |
*
|
|
@@ -302,7 +407,7 @@ export declare function toDocumentDraft07(document: Document<"draft-2020-12">):
|
|
| 302 |
*
|
| 303 |
* @see {@link toDocumentDraft07}
|
| 304 |
* @see {@link MultiDocument}
|
| 305 |
-
*
|
| 306 |
* @since 4.0.0
|
| 307 |
*/
|
| 308 |
export declare function toMultiDocumentOpenApi3_1(multiDocument: MultiDocument<"draft-2020-12">): MultiDocument<"openapi-3.1">;
|
|
@@ -310,12 +415,19 @@ export declare function toMultiDocumentOpenApi3_1(multiDocument: MultiDocument<"
|
|
| 310 |
* Resolves a `$ref` string by looking up the last path segment in a
|
| 311 |
* definitions map.
|
| 312 |
*
|
| 313 |
-
*
|
| 314 |
-
*
|
| 315 |
-
*
|
| 316 |
-
*
|
| 317 |
-
*
|
| 318 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
*
|
| 320 |
* **Example** (Resolving a $ref)
|
| 321 |
*
|
|
@@ -335,20 +447,22 @@ export declare function toMultiDocumentOpenApi3_1(multiDocument: MultiDocument<"
|
|
| 335 |
*
|
| 336 |
* @see {@link resolveTopLevel$ref}
|
| 337 |
* @see {@link Definitions}
|
| 338 |
-
*
|
| 339 |
* @since 4.0.0
|
| 340 |
*/
|
| 341 |
export declare function resolve$ref($ref: string, definitions: Definitions): JsonSchema | undefined;
|
| 342 |
/**
|
| 343 |
-
*
|
| 344 |
-
* document's definitions and returns a new document with the inlined
|
| 345 |
-
* schema. Returns the original document unchanged if the root schema is
|
| 346 |
-
* not a `$ref` or if the referenced definition is not found.
|
| 347 |
*
|
| 348 |
-
*
|
| 349 |
-
*
|
| 350 |
-
*
|
| 351 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 352 |
*
|
| 353 |
* **Example** (Resolving a top-level $ref)
|
| 354 |
*
|
|
@@ -369,7 +483,7 @@ export declare function resolve$ref($ref: string, definitions: Definitions): Jso
|
|
| 369 |
*
|
| 370 |
* @see {@link resolve$ref}
|
| 371 |
* @see {@link Document}
|
| 372 |
-
*
|
| 373 |
* @since 4.0.0
|
| 374 |
*/
|
| 375 |
export declare function resolveTopLevel$ref(document: Document<"draft-2020-12">): Document<"draft-2020-12">;
|
|
|
|
| 1 |
/**
|
| 2 |
* A plain object representing a single JSON Schema node.
|
| 3 |
*
|
| 4 |
+
* **When to use**
|
|
|
|
|
|
|
| 5 |
*
|
| 6 |
+
* Use to represent an arbitrary JSON Schema object regardless of dialect.
|
| 7 |
+
*
|
| 8 |
+
* **Details**
|
| 9 |
+
*
|
| 10 |
+
* This is an open record type (`[x: string]: unknown`) so it can hold any JSON
|
| 11 |
+
* Schema keyword. Most functions in this module accept or return this type.
|
| 12 |
+
*
|
| 13 |
+
* @category models
|
| 14 |
* @since 4.0.0
|
| 15 |
*/
|
| 16 |
export interface JsonSchema {
|
|
|
|
| 19 |
/**
|
| 20 |
* The set of JSON Schema dialects supported by this module.
|
| 21 |
*
|
| 22 |
+
* **When to use**
|
| 23 |
+
*
|
| 24 |
+
* Use as the dialect marker for `JsonSchema` documents when parsing,
|
| 25 |
+
* converting, or emitting schemas across the supported formats.
|
| 26 |
+
*
|
| 27 |
+
* **Details**
|
| 28 |
*
|
| 29 |
+
* Supported values are `"draft-07"` for JSON Schema Draft-07,
|
| 30 |
+
* `"draft-2020-12"` for JSON Schema Draft 2020-12 and the canonical internal
|
| 31 |
+
* form, `"openapi-3.1"` for OpenAPI 3.1, and `"openapi-3.0"` for OpenAPI 3.0.
|
| 32 |
+
*
|
| 33 |
+
* @see {@link Document} for a single root schema tagged with a dialect
|
| 34 |
+
* @see {@link MultiDocument} for multiple root schemas tagged with a dialect
|
| 35 |
+
*
|
| 36 |
+
* @category models
|
| 37 |
* @since 4.0.0
|
| 38 |
*/
|
| 39 |
export type Dialect = "draft-07" | "draft-2020-12" | "openapi-3.1" | "openapi-3.0";
|
| 40 |
/**
|
| 41 |
* The JSON Schema primitive type names.
|
| 42 |
*
|
| 43 |
+
* **When to use**
|
| 44 |
+
*
|
| 45 |
+
* Use to restrict a JSON Schema `type` keyword to the supported primitive names.
|
| 46 |
+
*
|
| 47 |
+
* @category models
|
| 48 |
* @since 4.0.0
|
| 49 |
*/
|
| 50 |
export type Type = "string" | "number" | "boolean" | "array" | "object" | "null" | "integer";
|
| 51 |
/**
|
| 52 |
* A record of named JSON Schema definitions, keyed by definition name.
|
| 53 |
*
|
| 54 |
+
* **When to use**
|
| 55 |
+
*
|
| 56 |
+
* Use as the shared lookup table for named JSON Schema nodes that are
|
| 57 |
+
* referenced from JSON Schema documents.
|
| 58 |
+
*
|
| 59 |
+
* **Details**
|
| 60 |
+
*
|
| 61 |
+
* The map is dialect-neutral. Conversion APIs emit it as `$defs`,
|
| 62 |
+
* `definitions`, or `components.schemas` depending on the target format.
|
| 63 |
+
*
|
| 64 |
+
* @see {@link Document} for a single root schema with definitions
|
| 65 |
+
* @see {@link MultiDocument} for multiple root schemas sharing definitions
|
| 66 |
+
* @see {@link resolve$ref} for resolving a `$ref` against definitions
|
| 67 |
+
*
|
| 68 |
+
* @category models
|
| 69 |
* @since 4.0.0
|
| 70 |
*/
|
| 71 |
export interface Definitions extends Record<string, JsonSchema> {
|
|
|
|
| 74 |
* A structured container for a single JSON Schema and its associated
|
| 75 |
* definitions.
|
| 76 |
*
|
| 77 |
+
* **When to use**
|
| 78 |
+
*
|
| 79 |
+
* Use when you need to carry a root schema together with its shared
|
| 80 |
+
* definitions, or when converting between dialects with the `from*` and `to*`
|
| 81 |
+
* functions.
|
| 82 |
+
*
|
| 83 |
+
* **Details**
|
| 84 |
*
|
| 85 |
* The `schema` field holds the root schema *without* the definitions
|
| 86 |
* collection. Root definitions are stored separately in `definitions` and
|
| 87 |
+
* referenced via `#/$defs/<name>` for Draft-2020-12, `#/definitions/<name>`
|
| 88 |
+
* for Draft-07, and `#/components/schemas/<name>` for OpenAPI 3.1 and
|
| 89 |
+
* OpenAPI 3.0.
|
|
|
|
| 90 |
*
|
| 91 |
* **Example** (Inspecting a parsed document)
|
| 92 |
*
|
|
|
|
| 107 |
*
|
| 108 |
* @see {@link MultiDocument}
|
| 109 |
* @see {@link fromSchemaDraft2020_12}
|
| 110 |
+
* @category models
|
| 111 |
* @since 4.0.0
|
| 112 |
*/
|
| 113 |
export interface Document<D extends Dialect> {
|
|
|
|
| 117 |
}
|
| 118 |
/**
|
| 119 |
* Like {@link Document}, but carries multiple root schemas that share a
|
| 120 |
+
* single definitions pool.
|
| 121 |
+
*
|
| 122 |
+
* **When to use**
|
| 123 |
*
|
| 124 |
+
* Use when generating several schemas, such as a request body
|
| 125 |
+
* and a response body, that reference the same set of definitions.
|
| 126 |
+
*
|
| 127 |
+
* **Details**
|
| 128 |
+
*
|
| 129 |
+
* The `schemas` tuple is non-empty and contains at least one element.
|
| 130 |
*
|
| 131 |
* @see {@link Document}
|
| 132 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 133 |
+
* @category models
|
| 134 |
* @since 4.0.0
|
| 135 |
*/
|
| 136 |
export interface MultiDocument<D extends Dialect> {
|
|
|
|
| 139 |
readonly definitions: Definitions;
|
| 140 |
}
|
| 141 |
/**
|
| 142 |
+
* Represents the `$schema` meta-schema URI for JSON Schema Draft-07.
|
| 143 |
+
*
|
| 144 |
+
* **When to use**
|
| 145 |
+
*
|
| 146 |
+
* Use when constructing a Draft-07 JSON Schema document and you need a stable
|
| 147 |
+
* value for the root `$schema` field.
|
| 148 |
*
|
| 149 |
+
* **Details**
|
| 150 |
+
*
|
| 151 |
+
* The exported value is the literal string
|
| 152 |
+
* `http://json-schema.org/draft-07/schema`.
|
| 153 |
+
*
|
| 154 |
+
* @see {@link META_SCHEMA_URI_DRAFT_2020_12} for the Draft 2020-12 `$schema` URI
|
| 155 |
+
*
|
| 156 |
+
* @category constants
|
| 157 |
* @since 4.0.0
|
| 158 |
*/
|
| 159 |
export declare const META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema";
|
| 160 |
/**
|
| 161 |
+
* Represents the `$schema` meta-schema URI for JSON Schema Draft 2020-12.
|
| 162 |
+
*
|
| 163 |
+
* **When to use**
|
| 164 |
*
|
| 165 |
+
* Use when you need to populate the `$schema` field while emitting a JSON
|
| 166 |
+
* Schema document that should declare JSON Schema Draft 2020-12.
|
| 167 |
+
*
|
| 168 |
+
* **Details**
|
| 169 |
+
*
|
| 170 |
+
* The exported value is the literal string
|
| 171 |
+
* `https://json-schema.org/draft/2020-12/schema`.
|
| 172 |
+
*
|
| 173 |
+
* @see {@link META_SCHEMA_URI_DRAFT_07} for the Draft-07 `$schema` URI
|
| 174 |
+
*
|
| 175 |
+
* @category constants
|
| 176 |
* @since 4.0.0
|
| 177 |
*/
|
| 178 |
export declare const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
| 179 |
/**
|
| 180 |
* Parses a raw Draft-07 JSON Schema into a `Document<"draft-2020-12">`.
|
| 181 |
*
|
| 182 |
+
* **When to use**
|
| 183 |
+
*
|
| 184 |
+
* Use when you have a raw JSON Schema object that follows Draft-07 conventions
|
| 185 |
+
* and need the canonical Draft-2020-12 document representation.
|
| 186 |
+
*
|
| 187 |
+
* **Details**
|
| 188 |
+
*
|
| 189 |
+
* This converts Draft-07 tuple syntax (`items` as array plus
|
| 190 |
+
* `additionalItems`) to Draft-2020-12 form (`prefixItems` plus `items`),
|
| 191 |
+
* rewrites `#/definitions/...` refs to `#/$defs/...`, and extracts root-level
|
| 192 |
+
* `definitions` into the `definitions` field.
|
| 193 |
+
*
|
| 194 |
+
* **Gotchas**
|
| 195 |
+
*
|
| 196 |
+
* Unsupported keywords, such as `if`/`then`/`else` and `$id`, are dropped.
|
| 197 |
*
|
| 198 |
* **Example** (Parsing a Draft-07 schema)
|
| 199 |
*
|
|
|
|
| 218 |
* @see {@link fromSchemaDraft2020_12}
|
| 219 |
* @see {@link fromSchemaOpenApi3_0}
|
| 220 |
* @see {@link toDocumentDraft07}
|
| 221 |
+
* @category decoding
|
| 222 |
* @since 4.0.0
|
| 223 |
*/
|
| 224 |
export declare function fromSchemaDraft07(js: JsonSchema): Document<"draft-2020-12">;
|
| 225 |
/**
|
| 226 |
* Parses a raw Draft-2020-12 JSON Schema into a `Document<"draft-2020-12">`.
|
| 227 |
*
|
| 228 |
+
* **When to use**
|
| 229 |
+
*
|
| 230 |
+
* Use when you already have a raw JSON Schema object in Draft-2020-12 format.
|
| 231 |
+
*
|
| 232 |
+
* **Details**
|
| 233 |
+
*
|
| 234 |
+
* This separates `$defs` from the root schema into the `definitions` field.
|
| 235 |
+
* Unlike {@link fromSchemaDraft07}, this performs no keyword rewriting.
|
| 236 |
*
|
| 237 |
* **Example** (Parsing a Draft-2020-12 schema)
|
| 238 |
*
|
|
|
|
| 252 |
*
|
| 253 |
* @see {@link fromSchemaDraft07}
|
| 254 |
* @see {@link fromSchemaOpenApi3_1}
|
| 255 |
+
* @category decoding
|
| 256 |
* @since 4.0.0
|
| 257 |
*/
|
| 258 |
export declare function fromSchemaDraft2020_12(js: JsonSchema): Document<"draft-2020-12">;
|
| 259 |
/**
|
| 260 |
* Parses a raw OpenAPI 3.1 JSON Schema into a `Document<"draft-2020-12">`.
|
| 261 |
*
|
| 262 |
+
* **When to use**
|
| 263 |
+
*
|
| 264 |
+
* Use when you need to consume raw JSON Schema objects from an OpenAPI 3.1
|
| 265 |
+
* specification.
|
| 266 |
+
*
|
| 267 |
+
* **Details**
|
| 268 |
+
*
|
| 269 |
+
* This rewrites `#/components/schemas/...` refs to `#/$defs/...`, then delegates
|
| 270 |
+
* to {@link fromSchemaDraft2020_12}.
|
| 271 |
*
|
| 272 |
* **Example** (Parsing an OpenAPI 3.1 schema)
|
| 273 |
*
|
|
|
|
| 288 |
*
|
| 289 |
* @see {@link fromSchemaOpenApi3_0}
|
| 290 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 291 |
+
* @category decoding
|
| 292 |
* @since 4.0.0
|
| 293 |
*/
|
| 294 |
export declare function fromSchemaOpenApi3_1(js: JsonSchema): Document<"draft-2020-12">;
|
| 295 |
/**
|
| 296 |
* Parses a raw OpenAPI 3.0 JSON Schema into a `Document<"draft-2020-12">`.
|
| 297 |
*
|
| 298 |
+
* **When to use**
|
| 299 |
+
*
|
| 300 |
+
* Use when you need to consume raw JSON Schema objects from an OpenAPI 3.0
|
| 301 |
+
* specification.
|
| 302 |
+
*
|
| 303 |
+
* **Details**
|
| 304 |
+
*
|
| 305 |
+
* This handles OpenAPI 3.0 extensions, including `nullable`, singular
|
| 306 |
+
* `example`, and boolean `exclusiveMinimum` or `exclusiveMaximum`. It
|
| 307 |
+
* normalizes the schema to Draft-07 first, then converts to Draft-2020-12 via
|
| 308 |
+
* {@link fromSchemaDraft07}.
|
| 309 |
*
|
| 310 |
* **Example** (Parsing an OpenAPI 3.0 nullable schema)
|
| 311 |
*
|
|
|
|
| 324 |
*
|
| 325 |
* @see {@link fromSchemaOpenApi3_1}
|
| 326 |
* @see {@link fromSchemaDraft07}
|
| 327 |
+
* @category decoding
|
| 328 |
* @since 4.0.0
|
| 329 |
*/
|
| 330 |
export declare function fromSchemaOpenApi3_0(schema: JsonSchema): Document<"draft-2020-12">;
|
| 331 |
/**
|
| 332 |
* Converts a `Document<"draft-2020-12">` to a `Document<"draft-07">`.
|
| 333 |
*
|
| 334 |
+
* **When to use**
|
| 335 |
+
*
|
| 336 |
+
* Use when you need to output a canonical JSON Schema document in Draft-07
|
| 337 |
+
* format.
|
| 338 |
+
*
|
| 339 |
+
* **Details**
|
| 340 |
+
*
|
| 341 |
+
* This rewrites `#/$defs/...` refs to `#/definitions/...`, converts
|
| 342 |
+
* Draft-2020-12 tuple syntax (`prefixItems` plus `items`) to Draft-07 form
|
| 343 |
+
* (`items` as array plus `additionalItems`), and converts both the root schema
|
| 344 |
+
* and all definitions.
|
| 345 |
+
*
|
| 346 |
+
* **Gotchas**
|
| 347 |
+
*
|
| 348 |
+
* Unsupported Draft-2020-12 keywords are dropped.
|
| 349 |
*
|
| 350 |
* **Example** (Converting to Draft-07)
|
| 351 |
*
|
|
|
|
| 366 |
*
|
| 367 |
* @see {@link fromSchemaDraft07}
|
| 368 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 369 |
+
* @category encoding
|
| 370 |
* @since 4.0.0
|
| 371 |
*/
|
| 372 |
export declare function toDocumentDraft07(document: Document<"draft-2020-12">): Document<"draft-07">;
|
|
|
|
| 374 |
* Converts a `MultiDocument<"draft-2020-12">` to a
|
| 375 |
* `MultiDocument<"openapi-3.1">`.
|
| 376 |
*
|
| 377 |
+
* **When to use**
|
| 378 |
+
*
|
| 379 |
+
* Use when you need to emit an OpenAPI 3.1 multi-document from canonical JSON
|
| 380 |
+
* Schema documents.
|
| 381 |
+
*
|
| 382 |
+
* **Details**
|
| 383 |
+
*
|
| 384 |
+
* This rewrites `#/$defs/...` refs to `#/components/schemas/...`, sanitizes
|
| 385 |
+
* definition keys to match the OpenAPI component key pattern
|
| 386 |
+
* (`^[a-zA-Z0-9.\-_]+$`) by replacing invalid characters with `_`, updates all
|
| 387 |
+
* `$ref` pointers to use the sanitized keys, and converts all schemas and
|
| 388 |
+
* definitions in the multi-document.
|
| 389 |
*
|
| 390 |
* **Example** (Converting to OpenAPI 3.1)
|
| 391 |
*
|
|
|
|
| 407 |
*
|
| 408 |
* @see {@link toDocumentDraft07}
|
| 409 |
* @see {@link MultiDocument}
|
| 410 |
+
* @category encoding
|
| 411 |
* @since 4.0.0
|
| 412 |
*/
|
| 413 |
export declare function toMultiDocumentOpenApi3_1(multiDocument: MultiDocument<"draft-2020-12">): MultiDocument<"openapi-3.1">;
|
|
|
|
| 415 |
* Resolves a `$ref` string by looking up the last path segment in a
|
| 416 |
* definitions map.
|
| 417 |
*
|
| 418 |
+
* **When to use**
|
| 419 |
+
*
|
| 420 |
+
* Use when you need to dereference a `$ref` pointer to get the JSON Schema
|
| 421 |
+
* object it points to.
|
| 422 |
+
*
|
| 423 |
+
* **Details**
|
| 424 |
+
*
|
| 425 |
+
* This only resolves the final segment of the ref path, such as `"User"` from
|
| 426 |
+
* `"#/$defs/User"`. It returns `undefined` if the definition is not found.
|
| 427 |
+
*
|
| 428 |
+
* **Gotchas**
|
| 429 |
+
*
|
| 430 |
+
* This function does not follow arbitrary JSON Pointer paths.
|
| 431 |
*
|
| 432 |
* **Example** (Resolving a $ref)
|
| 433 |
*
|
|
|
|
| 447 |
*
|
| 448 |
* @see {@link resolveTopLevel$ref}
|
| 449 |
* @see {@link Definitions}
|
| 450 |
+
* @category getters
|
| 451 |
* @since 4.0.0
|
| 452 |
*/
|
| 453 |
export declare function resolve$ref($ref: string, definitions: Definitions): JsonSchema | undefined;
|
| 454 |
/**
|
| 455 |
+
* Resolves a document whose root schema is a top-level `$ref`.
|
|
|
|
|
|
|
|
|
|
| 456 |
*
|
| 457 |
+
* **When to use**
|
| 458 |
+
*
|
| 459 |
+
* Use when you need to dereference a top-level `$ref` before inspecting the
|
| 460 |
+
* root JSON Schema object's properties directly.
|
| 461 |
+
*
|
| 462 |
+
* **Details**
|
| 463 |
+
*
|
| 464 |
+
* This returns the same object if no change is needed, or a shallow copy with
|
| 465 |
+
* the resolved schema.
|
| 466 |
*
|
| 467 |
* **Example** (Resolving a top-level $ref)
|
| 468 |
*
|
|
|
|
| 483 |
*
|
| 484 |
* @see {@link resolve$ref}
|
| 485 |
* @see {@link Document}
|
| 486 |
+
* @category transforming
|
| 487 |
* @since 4.0.0
|
| 488 |
*/
|
| 489 |
export declare function resolveTopLevel$ref(document: Document<"draft-2020-12">): Document<"draft-2020-12">;
|
.opencode/node_modules/effect/dist/JsonSchema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonSchema.d.ts","sourceRoot":"","sources":["../src/JsonSchema.ts"],"names":[],"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-1,86 +1,10 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
| 3 |
-
*
|
| 4 |
-
*
|
| 5 |
-
*
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* - **JsonSchema** — a plain object with string keys; represents any single
|
| 10 |
-
* JSON Schema node.
|
| 11 |
-
* - **Dialect** — one of `"draft-07"`, `"draft-2020-12"`, `"openapi-3.1"`,
|
| 12 |
-
* or `"openapi-3.0"`.
|
| 13 |
-
* - **Document** — a structured container holding a root `schema`, its
|
| 14 |
-
* companion `definitions`, and the target `dialect`. Definitions are
|
| 15 |
-
* stored separately from the root schema so they can be relocated when
|
| 16 |
-
* converting between dialects.
|
| 17 |
-
* - **MultiDocument** — same as `Document` but carries multiple root
|
| 18 |
-
* schemas (at least one). Useful when generating several schemas that
|
| 19 |
-
* share a single definitions pool.
|
| 20 |
-
* - **Definitions** — a `Record<string, JsonSchema>` keyed by definition
|
| 21 |
-
* name. The ref pointer prefix depends on the dialect.
|
| 22 |
-
* - **`from*` functions** — parse a raw JSON Schema object into the
|
| 23 |
-
* canonical `Document<"draft-2020-12">`.
|
| 24 |
-
* - **`to*` functions** — convert from the canonical representation to a
|
| 25 |
-
* specific output dialect.
|
| 26 |
-
*
|
| 27 |
-
* ## Common tasks
|
| 28 |
-
*
|
| 29 |
-
* - Parse a Draft-07 schema → {@link fromSchemaDraft07}
|
| 30 |
-
* - Parse a Draft-2020-12 schema → {@link fromSchemaDraft2020_12}
|
| 31 |
-
* - Parse an OpenAPI 3.1 schema → {@link fromSchemaOpenApi3_1}
|
| 32 |
-
* - Parse an OpenAPI 3.0 schema → {@link fromSchemaOpenApi3_0}
|
| 33 |
-
* - Convert to Draft-07 output → {@link toDocumentDraft07}
|
| 34 |
-
* - Convert to OpenAPI 3.1 output → {@link toMultiDocumentOpenApi3_1}
|
| 35 |
-
* - Resolve a `$ref` against definitions → {@link resolve$ref}
|
| 36 |
-
* - Inline the root `$ref` of a document → {@link resolveTopLevel$ref}
|
| 37 |
-
*
|
| 38 |
-
* ## Gotchas
|
| 39 |
-
*
|
| 40 |
-
* - All `from*` functions normalize to `Document<"draft-2020-12">`
|
| 41 |
-
* regardless of the input dialect.
|
| 42 |
-
* - Unsupported or unrecognized JSON Schema keywords are silently dropped
|
| 43 |
-
* during conversion.
|
| 44 |
-
* - Draft-07 tuple syntax (`items` as array + `additionalItems`) is
|
| 45 |
-
* converted to 2020-12 form (`prefixItems` + `items`), and vice-versa.
|
| 46 |
-
* - OpenAPI 3.0 `nullable: true` is expanded into `type` arrays or
|
| 47 |
-
* `anyOf` unions. The `nullable` keyword is removed.
|
| 48 |
-
* - OpenAPI 3.0 singular `example` is converted to `examples` (array).
|
| 49 |
-
* - {@link resolve$ref} only looks up the last segment of the ref path in
|
| 50 |
-
* the definitions map; it does not follow arbitrary JSON Pointer paths.
|
| 51 |
-
*
|
| 52 |
-
* ## Quickstart
|
| 53 |
-
*
|
| 54 |
-
* **Example** (Parse a Draft-07 schema and convert to Draft-07 output)
|
| 55 |
-
*
|
| 56 |
-
* ```ts
|
| 57 |
-
* import { JsonSchema } from "effect"
|
| 58 |
-
*
|
| 59 |
-
* const raw: JsonSchema.JsonSchema = {
|
| 60 |
-
* type: "object",
|
| 61 |
-
* properties: {
|
| 62 |
-
* name: { type: "string" }
|
| 63 |
-
* },
|
| 64 |
-
* required: ["name"]
|
| 65 |
-
* }
|
| 66 |
-
*
|
| 67 |
-
* // Parse into canonical form
|
| 68 |
-
* const doc = JsonSchema.fromSchemaDraft07(raw)
|
| 69 |
-
*
|
| 70 |
-
* // Convert back to Draft-07
|
| 71 |
-
* const draft07 = JsonSchema.toDocumentDraft07(doc)
|
| 72 |
-
*
|
| 73 |
-
* console.log(draft07.dialect) // "draft-07"
|
| 74 |
-
* console.log(draft07.schema) // { type: "object", properties: { name: { type: "string" } }, required: ["name"] }
|
| 75 |
-
* ```
|
| 76 |
-
*
|
| 77 |
-
* ## See also
|
| 78 |
-
*
|
| 79 |
-
* - {@link Document}
|
| 80 |
-
* - {@link MultiDocument}
|
| 81 |
-
* - {@link fromSchemaDraft07}
|
| 82 |
-
* - {@link toDocumentDraft07}
|
| 83 |
-
* - {@link resolve$ref}
|
| 84 |
*
|
| 85 |
* @since 4.0.0
|
| 86 |
*/
|
|
@@ -89,14 +13,40 @@ import { unescapeToken } from "./JsonPointer.js";
|
|
| 89 |
import * as Predicate from "./Predicate.js";
|
| 90 |
import * as Rec from "./Record.js";
|
| 91 |
/**
|
| 92 |
-
*
|
| 93 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
* @since 4.0.0
|
| 95 |
*/
|
| 96 |
export const META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema";
|
| 97 |
/**
|
| 98 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
* @since 4.0.0
|
| 101 |
*/
|
| 102 |
export const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
@@ -106,13 +56,21 @@ const RE_COMPONENTS_SCHEMAS = /^#\/components\/schemas(?=\/|$)/;
|
|
| 106 |
/**
|
| 107 |
* Parses a raw Draft-07 JSON Schema into a `Document<"draft-2020-12">`.
|
| 108 |
*
|
| 109 |
-
*
|
| 110 |
-
*
|
| 111 |
-
*
|
| 112 |
-
*
|
| 113 |
-
*
|
| 114 |
-
*
|
| 115 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
*
|
| 117 |
* **Example** (Parsing a Draft-07 schema)
|
| 118 |
*
|
|
@@ -137,7 +95,7 @@ const RE_COMPONENTS_SCHEMAS = /^#\/components\/schemas(?=\/|$)/;
|
|
| 137 |
* @see {@link fromSchemaDraft2020_12}
|
| 138 |
* @see {@link fromSchemaOpenApi3_0}
|
| 139 |
* @see {@link toDocumentDraft07}
|
| 140 |
-
*
|
| 141 |
* @since 4.0.0
|
| 142 |
*/
|
| 143 |
export function fromSchemaDraft07(js) {
|
|
@@ -237,10 +195,14 @@ export function fromSchemaDraft07(js) {
|
|
| 237 |
/**
|
| 238 |
* Parses a raw Draft-2020-12 JSON Schema into a `Document<"draft-2020-12">`.
|
| 239 |
*
|
| 240 |
-
*
|
| 241 |
-
*
|
| 242 |
-
*
|
| 243 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
*
|
| 245 |
* **Example** (Parsing a Draft-2020-12 schema)
|
| 246 |
*
|
|
@@ -260,7 +222,7 @@ export function fromSchemaDraft07(js) {
|
|
| 260 |
*
|
| 261 |
* @see {@link fromSchemaDraft07}
|
| 262 |
* @see {@link fromSchemaOpenApi3_1}
|
| 263 |
-
*
|
| 264 |
* @since 4.0.0
|
| 265 |
*/
|
| 266 |
export function fromSchemaDraft2020_12(js) {
|
|
@@ -277,10 +239,15 @@ export function fromSchemaDraft2020_12(js) {
|
|
| 277 |
/**
|
| 278 |
* Parses a raw OpenAPI 3.1 JSON Schema into a `Document<"draft-2020-12">`.
|
| 279 |
*
|
| 280 |
-
*
|
| 281 |
-
*
|
| 282 |
-
*
|
| 283 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
*
|
| 285 |
* **Example** (Parsing an OpenAPI 3.1 schema)
|
| 286 |
*
|
|
@@ -301,7 +268,7 @@ export function fromSchemaDraft2020_12(js) {
|
|
| 301 |
*
|
| 302 |
* @see {@link fromSchemaOpenApi3_0}
|
| 303 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 304 |
-
*
|
| 305 |
* @since 4.0.0
|
| 306 |
*/
|
| 307 |
export function fromSchemaOpenApi3_1(js) {
|
|
@@ -311,12 +278,17 @@ export function fromSchemaOpenApi3_1(js) {
|
|
| 311 |
/**
|
| 312 |
* Parses a raw OpenAPI 3.0 JSON Schema into a `Document<"draft-2020-12">`.
|
| 313 |
*
|
| 314 |
-
*
|
| 315 |
-
*
|
| 316 |
-
*
|
| 317 |
-
*
|
| 318 |
-
*
|
| 319 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
*
|
| 321 |
* **Example** (Parsing an OpenAPI 3.0 nullable schema)
|
| 322 |
*
|
|
@@ -335,7 +307,7 @@ export function fromSchemaOpenApi3_1(js) {
|
|
| 335 |
*
|
| 336 |
* @see {@link fromSchemaOpenApi3_1}
|
| 337 |
* @see {@link fromSchemaDraft07}
|
| 338 |
-
*
|
| 339 |
* @since 4.0.0
|
| 340 |
*/
|
| 341 |
export function fromSchemaOpenApi3_0(schema) {
|
|
@@ -345,13 +317,21 @@ export function fromSchemaOpenApi3_0(schema) {
|
|
| 345 |
/**
|
| 346 |
* Converts a `Document<"draft-2020-12">` to a `Document<"draft-07">`.
|
| 347 |
*
|
| 348 |
-
*
|
| 349 |
-
*
|
| 350 |
-
*
|
| 351 |
-
*
|
| 352 |
-
*
|
| 353 |
-
*
|
| 354 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
*
|
| 356 |
* **Example** (Converting to Draft-07)
|
| 357 |
*
|
|
@@ -372,7 +352,7 @@ export function fromSchemaOpenApi3_0(schema) {
|
|
| 372 |
*
|
| 373 |
* @see {@link fromSchemaDraft07}
|
| 374 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 375 |
-
*
|
| 376 |
* @since 4.0.0
|
| 377 |
*/
|
| 378 |
export function toDocumentDraft07(document) {
|
|
@@ -474,13 +454,18 @@ function toSchemaDraft07(schema) {
|
|
| 474 |
* Converts a `MultiDocument<"draft-2020-12">` to a
|
| 475 |
* `MultiDocument<"openapi-3.1">`.
|
| 476 |
*
|
| 477 |
-
*
|
| 478 |
-
*
|
| 479 |
-
*
|
| 480 |
-
*
|
| 481 |
-
*
|
| 482 |
-
*
|
| 483 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
*
|
| 485 |
* **Example** (Converting to OpenAPI 3.1)
|
| 486 |
*
|
|
@@ -502,7 +487,7 @@ function toSchemaDraft07(schema) {
|
|
| 502 |
*
|
| 503 |
* @see {@link toDocumentDraft07}
|
| 504 |
* @see {@link MultiDocument}
|
| 505 |
-
*
|
| 506 |
* @since 4.0.0
|
| 507 |
*/
|
| 508 |
export function toMultiDocumentOpenApi3_1(multiDocument) {
|
|
@@ -682,12 +667,19 @@ function widen_type(node) {
|
|
| 682 |
* Resolves a `$ref` string by looking up the last path segment in a
|
| 683 |
* definitions map.
|
| 684 |
*
|
| 685 |
-
*
|
| 686 |
-
*
|
| 687 |
-
*
|
| 688 |
-
*
|
| 689 |
-
*
|
| 690 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 691 |
*
|
| 692 |
* **Example** (Resolving a $ref)
|
| 693 |
*
|
|
@@ -707,7 +699,7 @@ function widen_type(node) {
|
|
| 707 |
*
|
| 708 |
* @see {@link resolveTopLevel$ref}
|
| 709 |
* @see {@link Definitions}
|
| 710 |
-
*
|
| 711 |
* @since 4.0.0
|
| 712 |
*/
|
| 713 |
export function resolve$ref($ref, definitions) {
|
|
@@ -721,15 +713,17 @@ export function resolve$ref($ref, definitions) {
|
|
| 721 |
}
|
| 722 |
}
|
| 723 |
/**
|
| 724 |
-
*
|
| 725 |
-
* document's definitions and returns a new document with the inlined
|
| 726 |
-
* schema. Returns the original document unchanged if the root schema is
|
| 727 |
-
* not a `$ref` or if the referenced definition is not found.
|
| 728 |
*
|
| 729 |
-
*
|
| 730 |
-
*
|
| 731 |
-
*
|
| 732 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
*
|
| 734 |
* **Example** (Resolving a top-level $ref)
|
| 735 |
*
|
|
@@ -750,7 +744,7 @@ export function resolve$ref($ref, definitions) {
|
|
| 750 |
*
|
| 751 |
* @see {@link resolve$ref}
|
| 752 |
* @see {@link Document}
|
| 753 |
-
*
|
| 754 |
* @since 4.0.0
|
| 755 |
*/
|
| 756 |
export function resolveTopLevel$ref(document) {
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Helpers for normalizing and converting JSON Schema and OpenAPI schema
|
| 3 |
+
* documents. Supported inputs include JSON Schema Draft-07, Draft 2020-12,
|
| 4 |
+
* OpenAPI 3.0, and OpenAPI 3.1; conversions normalize through
|
| 5 |
+
* `Document<"draft-2020-12">` before emitting another dialect. The module also
|
| 6 |
+
* defines document types, meta-schema constants, OpenAPI component-key helpers,
|
| 7 |
+
* and `$ref` resolution utilities.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
*
|
| 9 |
* @since 4.0.0
|
| 10 |
*/
|
|
|
|
| 13 |
import * as Predicate from "./Predicate.js";
|
| 14 |
import * as Rec from "./Record.js";
|
| 15 |
/**
|
| 16 |
+
* Represents the `$schema` meta-schema URI for JSON Schema Draft-07.
|
| 17 |
*
|
| 18 |
+
* **When to use**
|
| 19 |
+
*
|
| 20 |
+
* Use when constructing a Draft-07 JSON Schema document and you need a stable
|
| 21 |
+
* value for the root `$schema` field.
|
| 22 |
+
*
|
| 23 |
+
* **Details**
|
| 24 |
+
*
|
| 25 |
+
* The exported value is the literal string
|
| 26 |
+
* `http://json-schema.org/draft-07/schema`.
|
| 27 |
+
*
|
| 28 |
+
* @see {@link META_SCHEMA_URI_DRAFT_2020_12} for the Draft 2020-12 `$schema` URI
|
| 29 |
+
*
|
| 30 |
+
* @category constants
|
| 31 |
* @since 4.0.0
|
| 32 |
*/
|
| 33 |
export const META_SCHEMA_URI_DRAFT_07 = "http://json-schema.org/draft-07/schema";
|
| 34 |
/**
|
| 35 |
+
* Represents the `$schema` meta-schema URI for JSON Schema Draft 2020-12.
|
| 36 |
+
*
|
| 37 |
+
* **When to use**
|
| 38 |
+
*
|
| 39 |
+
* Use when you need to populate the `$schema` field while emitting a JSON
|
| 40 |
+
* Schema document that should declare JSON Schema Draft 2020-12.
|
| 41 |
+
*
|
| 42 |
+
* **Details**
|
| 43 |
*
|
| 44 |
+
* The exported value is the literal string
|
| 45 |
+
* `https://json-schema.org/draft/2020-12/schema`.
|
| 46 |
+
*
|
| 47 |
+
* @see {@link META_SCHEMA_URI_DRAFT_07} for the Draft-07 `$schema` URI
|
| 48 |
+
*
|
| 49 |
+
* @category constants
|
| 50 |
* @since 4.0.0
|
| 51 |
*/
|
| 52 |
export const META_SCHEMA_URI_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
|
|
| 56 |
/**
|
| 57 |
* Parses a raw Draft-07 JSON Schema into a `Document<"draft-2020-12">`.
|
| 58 |
*
|
| 59 |
+
* **When to use**
|
| 60 |
+
*
|
| 61 |
+
* Use when you have a raw JSON Schema object that follows Draft-07 conventions
|
| 62 |
+
* and need the canonical Draft-2020-12 document representation.
|
| 63 |
+
*
|
| 64 |
+
* **Details**
|
| 65 |
+
*
|
| 66 |
+
* This converts Draft-07 tuple syntax (`items` as array plus
|
| 67 |
+
* `additionalItems`) to Draft-2020-12 form (`prefixItems` plus `items`),
|
| 68 |
+
* rewrites `#/definitions/...` refs to `#/$defs/...`, and extracts root-level
|
| 69 |
+
* `definitions` into the `definitions` field.
|
| 70 |
+
*
|
| 71 |
+
* **Gotchas**
|
| 72 |
+
*
|
| 73 |
+
* Unsupported keywords, such as `if`/`then`/`else` and `$id`, are dropped.
|
| 74 |
*
|
| 75 |
* **Example** (Parsing a Draft-07 schema)
|
| 76 |
*
|
|
|
|
| 95 |
* @see {@link fromSchemaDraft2020_12}
|
| 96 |
* @see {@link fromSchemaOpenApi3_0}
|
| 97 |
* @see {@link toDocumentDraft07}
|
| 98 |
+
* @category decoding
|
| 99 |
* @since 4.0.0
|
| 100 |
*/
|
| 101 |
export function fromSchemaDraft07(js) {
|
|
|
|
| 195 |
/**
|
| 196 |
* Parses a raw Draft-2020-12 JSON Schema into a `Document<"draft-2020-12">`.
|
| 197 |
*
|
| 198 |
+
* **When to use**
|
| 199 |
+
*
|
| 200 |
+
* Use when you already have a raw JSON Schema object in Draft-2020-12 format.
|
| 201 |
+
*
|
| 202 |
+
* **Details**
|
| 203 |
+
*
|
| 204 |
+
* This separates `$defs` from the root schema into the `definitions` field.
|
| 205 |
+
* Unlike {@link fromSchemaDraft07}, this performs no keyword rewriting.
|
| 206 |
*
|
| 207 |
* **Example** (Parsing a Draft-2020-12 schema)
|
| 208 |
*
|
|
|
|
| 222 |
*
|
| 223 |
* @see {@link fromSchemaDraft07}
|
| 224 |
* @see {@link fromSchemaOpenApi3_1}
|
| 225 |
+
* @category decoding
|
| 226 |
* @since 4.0.0
|
| 227 |
*/
|
| 228 |
export function fromSchemaDraft2020_12(js) {
|
|
|
|
| 239 |
/**
|
| 240 |
* Parses a raw OpenAPI 3.1 JSON Schema into a `Document<"draft-2020-12">`.
|
| 241 |
*
|
| 242 |
+
* **When to use**
|
| 243 |
+
*
|
| 244 |
+
* Use when you need to consume raw JSON Schema objects from an OpenAPI 3.1
|
| 245 |
+
* specification.
|
| 246 |
+
*
|
| 247 |
+
* **Details**
|
| 248 |
+
*
|
| 249 |
+
* This rewrites `#/components/schemas/...` refs to `#/$defs/...`, then delegates
|
| 250 |
+
* to {@link fromSchemaDraft2020_12}.
|
| 251 |
*
|
| 252 |
* **Example** (Parsing an OpenAPI 3.1 schema)
|
| 253 |
*
|
|
|
|
| 268 |
*
|
| 269 |
* @see {@link fromSchemaOpenApi3_0}
|
| 270 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 271 |
+
* @category decoding
|
| 272 |
* @since 4.0.0
|
| 273 |
*/
|
| 274 |
export function fromSchemaOpenApi3_1(js) {
|
|
|
|
| 278 |
/**
|
| 279 |
* Parses a raw OpenAPI 3.0 JSON Schema into a `Document<"draft-2020-12">`.
|
| 280 |
*
|
| 281 |
+
* **When to use**
|
| 282 |
+
*
|
| 283 |
+
* Use when you need to consume raw JSON Schema objects from an OpenAPI 3.0
|
| 284 |
+
* specification.
|
| 285 |
+
*
|
| 286 |
+
* **Details**
|
| 287 |
+
*
|
| 288 |
+
* This handles OpenAPI 3.0 extensions, including `nullable`, singular
|
| 289 |
+
* `example`, and boolean `exclusiveMinimum` or `exclusiveMaximum`. It
|
| 290 |
+
* normalizes the schema to Draft-07 first, then converts to Draft-2020-12 via
|
| 291 |
+
* {@link fromSchemaDraft07}.
|
| 292 |
*
|
| 293 |
* **Example** (Parsing an OpenAPI 3.0 nullable schema)
|
| 294 |
*
|
|
|
|
| 307 |
*
|
| 308 |
* @see {@link fromSchemaOpenApi3_1}
|
| 309 |
* @see {@link fromSchemaDraft07}
|
| 310 |
+
* @category decoding
|
| 311 |
* @since 4.0.0
|
| 312 |
*/
|
| 313 |
export function fromSchemaOpenApi3_0(schema) {
|
|
|
|
| 317 |
/**
|
| 318 |
* Converts a `Document<"draft-2020-12">` to a `Document<"draft-07">`.
|
| 319 |
*
|
| 320 |
+
* **When to use**
|
| 321 |
+
*
|
| 322 |
+
* Use when you need to output a canonical JSON Schema document in Draft-07
|
| 323 |
+
* format.
|
| 324 |
+
*
|
| 325 |
+
* **Details**
|
| 326 |
+
*
|
| 327 |
+
* This rewrites `#/$defs/...` refs to `#/definitions/...`, converts
|
| 328 |
+
* Draft-2020-12 tuple syntax (`prefixItems` plus `items`) to Draft-07 form
|
| 329 |
+
* (`items` as array plus `additionalItems`), and converts both the root schema
|
| 330 |
+
* and all definitions.
|
| 331 |
+
*
|
| 332 |
+
* **Gotchas**
|
| 333 |
+
*
|
| 334 |
+
* Unsupported Draft-2020-12 keywords are dropped.
|
| 335 |
*
|
| 336 |
* **Example** (Converting to Draft-07)
|
| 337 |
*
|
|
|
|
| 352 |
*
|
| 353 |
* @see {@link fromSchemaDraft07}
|
| 354 |
* @see {@link toMultiDocumentOpenApi3_1}
|
| 355 |
+
* @category encoding
|
| 356 |
* @since 4.0.0
|
| 357 |
*/
|
| 358 |
export function toDocumentDraft07(document) {
|
|
|
|
| 454 |
* Converts a `MultiDocument<"draft-2020-12">` to a
|
| 455 |
* `MultiDocument<"openapi-3.1">`.
|
| 456 |
*
|
| 457 |
+
* **When to use**
|
| 458 |
+
*
|
| 459 |
+
* Use when you need to emit an OpenAPI 3.1 multi-document from canonical JSON
|
| 460 |
+
* Schema documents.
|
| 461 |
+
*
|
| 462 |
+
* **Details**
|
| 463 |
+
*
|
| 464 |
+
* This rewrites `#/$defs/...` refs to `#/components/schemas/...`, sanitizes
|
| 465 |
+
* definition keys to match the OpenAPI component key pattern
|
| 466 |
+
* (`^[a-zA-Z0-9.\-_]+$`) by replacing invalid characters with `_`, updates all
|
| 467 |
+
* `$ref` pointers to use the sanitized keys, and converts all schemas and
|
| 468 |
+
* definitions in the multi-document.
|
| 469 |
*
|
| 470 |
* **Example** (Converting to OpenAPI 3.1)
|
| 471 |
*
|
|
|
|
| 487 |
*
|
| 488 |
* @see {@link toDocumentDraft07}
|
| 489 |
* @see {@link MultiDocument}
|
| 490 |
+
* @category encoding
|
| 491 |
* @since 4.0.0
|
| 492 |
*/
|
| 493 |
export function toMultiDocumentOpenApi3_1(multiDocument) {
|
|
|
|
| 667 |
* Resolves a `$ref` string by looking up the last path segment in a
|
| 668 |
* definitions map.
|
| 669 |
*
|
| 670 |
+
* **When to use**
|
| 671 |
+
*
|
| 672 |
+
* Use when you need to dereference a `$ref` pointer to get the JSON Schema
|
| 673 |
+
* object it points to.
|
| 674 |
+
*
|
| 675 |
+
* **Details**
|
| 676 |
+
*
|
| 677 |
+
* This only resolves the final segment of the ref path, such as `"User"` from
|
| 678 |
+
* `"#/$defs/User"`. It returns `undefined` if the definition is not found.
|
| 679 |
+
*
|
| 680 |
+
* **Gotchas**
|
| 681 |
+
*
|
| 682 |
+
* This function does not follow arbitrary JSON Pointer paths.
|
| 683 |
*
|
| 684 |
* **Example** (Resolving a $ref)
|
| 685 |
*
|
|
|
|
| 699 |
*
|
| 700 |
* @see {@link resolveTopLevel$ref}
|
| 701 |
* @see {@link Definitions}
|
| 702 |
+
* @category getters
|
| 703 |
* @since 4.0.0
|
| 704 |
*/
|
| 705 |
export function resolve$ref($ref, definitions) {
|
|
|
|
| 713 |
}
|
| 714 |
}
|
| 715 |
/**
|
| 716 |
+
* Resolves a document whose root schema is a top-level `$ref`.
|
|
|
|
|
|
|
|
|
|
| 717 |
*
|
| 718 |
+
* **When to use**
|
| 719 |
+
*
|
| 720 |
+
* Use when you need to dereference a top-level `$ref` before inspecting the
|
| 721 |
+
* root JSON Schema object's properties directly.
|
| 722 |
+
*
|
| 723 |
+
* **Details**
|
| 724 |
+
*
|
| 725 |
+
* This returns the same object if no change is needed, or a shallow copy with
|
| 726 |
+
* the resolved schema.
|
| 727 |
*
|
| 728 |
* **Example** (Resolving a top-level $ref)
|
| 729 |
*
|
|
|
|
| 744 |
*
|
| 745 |
* @see {@link resolve$ref}
|
| 746 |
* @see {@link Document}
|
| 747 |
+
* @category transforming
|
| 748 |
* @since 4.0.0
|
| 749 |
*/
|
| 750 |
export function resolveTopLevel$ref(document) {
|
.opencode/node_modules/effect/dist/JsonSchema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"JsonSchema.js","names":["Arr","unescapeToken","Predicate","Rec","META_SCHEMA_URI_DRAFT_07","META_SCHEMA_URI_DRAFT_2020_12","RE_DEFINITIONS","RE_DEFS","RE_COMPONENTS_SCHEMAS","fromSchemaDraft07","js","definitions","schema","walk","dialect","node","isRoot","Array","isArray","map","v","isObject","out","prefixItems","undefined","additionalItems","k","Object","keys","$ref","replace","mapped","walk_object","x","items","fromSchemaDraft2020_12","$defs","fromSchemaOpenApi3_1","rewrite_refs","ref","fromSchemaOpenApi3_0","normalized","normalize_OpenApi3_0_to_Draft07","toDocumentDraft07","document","toSchemaDraft07","rewrite","_isRoot","src","toMultiDocumentOpenApi3_1","multiDocument","keyMap","Map","key","sanitized","sanitizeOpenApiComponentsSchemasKey","set","tokens","split","length","identifier","get","slice","join","schemas","mapEntries","definition","VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP","s","test","ch","code","codePointAt","push","f","value","examples","adjust_exclusivity","nullable","apply_nullable","exclusiveMinimum","minimum","exclusiveMaximum","maximum","enum","widen_type","includes","type","const","anyOf","t","resolve$ref","resolveTopLevel$ref"],"sources":["../src/JsonSchema.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,OAAO,KAAKA,GAAG,MAAM,YAAY;AACjC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,GAAG,MAAM,aAAa;AAuGlC;;;;;AAKA,OAAO,MAAMC,wBAAwB,GAAG,wCAAwC;AAEhF;;;;;AAKA,OAAO,MAAMC,6BAA6B,GAAG,8CAA8C;AAE3F,MAAMC,cAAc,GAAG,yBAAyB;AAChD,MAAMC,OAAO,GAAG,oBAAoB;AACpC,MAAMC,qBAAqB,GAAG,iCAAiC;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AI,KAAK,QAAQ,EAAE;IAC5C,MAAMjB,MAAM,GAAG+E,WAAW,CAAC/C,QAAQ,CAAChC,MAAM,CAACiB,IAAI,EAAEe,QAAQ,CAACjC,WAAW,CAAC;IACtE,IAAIC,MAAM,KAAKY,SAAS,EAAE;MACxB,OAAO;QAAE,GAAGoB,QAAQ;QAAEhC;MAAM,CAAE;IAChC;EACF;EACA,OAAOgC,QAAQ;AACjB","ignoreList":[]}
|
|
|
|
| 1 |
+
{"version":3,"file":"JsonSchema.js","names":["Arr","unescapeToken","Predicate","Rec","META_SCHEMA_URI_DRAFT_07","META_SCHEMA_URI_DRAFT_2020_12","RE_DEFINITIONS","RE_DEFS","RE_COMPONENTS_SCHEMAS","fromSchemaDraft07","js","definitions","schema","walk","dialect","node","isRoot","Array","isArray","map","v","isObject","out","prefixItems","undefined","additionalItems","k","Object","keys","$ref","replace","mapped","walk_object","x","items","fromSchemaDraft2020_12","$defs","fromSchemaOpenApi3_1","rewrite_refs","ref","fromSchemaOpenApi3_0","normalized","normalize_OpenApi3_0_to_Draft07","toDocumentDraft07","document","toSchemaDraft07","rewrite","_isRoot","src","toMultiDocumentOpenApi3_1","multiDocument","keyMap","Map","key","sanitized","sanitizeOpenApiComponentsSchemasKey","set","tokens","split","length","identifier","get","slice","join","schemas","mapEntries","definition","VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP","s","test","ch","code","codePointAt","push","f","value","examples","adjust_exclusivity","nullable","apply_nullable","exclusiveMinimum","minimum","exclusiveMaximum","maximum","enum","widen_type","includes","type","const","anyOf","t","resolve$ref","resolveTopLevel$ref"],"sources":["../src/JsonSchema.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAUA,OAAO,KAAKA,GAAG,MAAM,YAAY;AACjC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,OAAO,KAAKC,SAAS,MAAM,gBAAgB;AAC3C,OAAO,KAAKC,GAAG,MAAM,aAAa;AAmJlC;;;;;;;;;;;;;;;;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IAC3D,MAAMO,UAAU,GAAGvD,WAAW,CAACiD,UAAU,CAAC;IAC1C,IAAIM,UAAU,KAAK1C,SAAS,EAAE;MAC5B,OAAO0C,UAAU;IACnB;EACF;AACF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAM,SAAU0B,mBAAmBA,CAAChD,QAAmC;EACrE,IAAI,OAAOA,QAAQ,CAAChC,MAAM,CAACiB,IAAI,KAAK,QAAQ,EAAE;IAC5C,MAAMjB,MAAM,GAAG+E,WAAW,CAAC/C,QAAQ,CAAChC,MAAM,CAACiB,IAAI,EAAEe,QAAQ,CAACjC,WAAW,CAAC;IACtE,IAAIC,MAAM,KAAKY,SAAS,EAAE;MACxB,OAAO;QAAE,GAAGoB,QAAQ;QAAEhC;MAAM,CAAE;IAChC;EACF;EACA,OAAOgC,QAAQ;AACjB","ignoreList":[]}
|
.opencode/node_modules/effect/dist/Latch.d.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
| 1 |
/**
|
| 2 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
*/
|
| 4 |
import type * as Effect from "./Effect.ts";
|
| 5 |
/**
|
| 6 |
-
*
|
| 7 |
-
*
|
| 8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
* ```ts
|
| 10 |
* import { Effect, Latch } from "effect"
|
| 11 |
*
|
|
@@ -19,33 +39,87 @@ import type * as Effect from "./Effect.ts";
|
|
| 19 |
* return "Latch was opened!"
|
| 20 |
* })
|
| 21 |
* ```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
*/
|
| 23 |
export interface Latch {
|
| 24 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
readonly open: Effect.Effect<boolean>;
|
| 26 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
openUnsafe(this: Latch): boolean;
|
| 28 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
readonly release: Effect.Effect<boolean>;
|
| 30 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
readonly await: Effect.Effect<void>;
|
| 32 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
readonly close: Effect.Effect<boolean>;
|
| 34 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
closeUnsafe(this: Latch): boolean;
|
| 36 |
-
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
whenOpen<A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
| 38 |
}
|
| 39 |
/**
|
| 40 |
-
* Creates a
|
|
|
|
|
|
|
| 41 |
*
|
| 42 |
-
*
|
|
|
|
| 43 |
*
|
| 44 |
-
*
|
| 45 |
*
|
| 46 |
-
*
|
|
|
|
|
|
|
| 47 |
*
|
| 48 |
-
* @example
|
| 49 |
* ```ts
|
| 50 |
* import { Effect, Latch } from "effect"
|
| 51 |
*
|
|
@@ -66,20 +140,25 @@ export interface Latch {
|
|
| 66 |
* const program = Effect.all([waiter, opener])
|
| 67 |
* ```
|
| 68 |
*
|
|
|
|
|
|
|
| 69 |
* @category constructors
|
| 70 |
-
* @since
|
| 71 |
*/
|
| 72 |
export declare const makeUnsafe: (open?: boolean | undefined) => Latch;
|
| 73 |
/**
|
| 74 |
-
* Creates a
|
| 75 |
*
|
| 76 |
-
* **
|
| 77 |
*
|
| 78 |
-
*
|
| 79 |
*
|
| 80 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
*
|
| 82 |
-
* @example
|
| 83 |
* ```ts
|
| 84 |
* import { Effect, Latch } from "effect"
|
| 85 |
*
|
|
@@ -102,26 +181,68 @@ export declare const makeUnsafe: (open?: boolean | undefined) => Latch;
|
|
| 102 |
* })
|
| 103 |
* ```
|
| 104 |
*
|
|
|
|
|
|
|
| 105 |
* @category constructors
|
| 106 |
-
* @since
|
| 107 |
*/
|
| 108 |
export declare const make: (open?: boolean | undefined) => Effect.Effect<Latch>;
|
| 109 |
/**
|
| 110 |
-
* Opens the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
*
|
| 112 |
* @category combinators
|
| 113 |
* @since 4.0.0
|
| 114 |
*/
|
| 115 |
export declare const open: (self: Latch) => Effect.Effect<boolean>;
|
| 116 |
/**
|
| 117 |
-
* Opens the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
*
|
| 119 |
* @category unsafe
|
| 120 |
* @since 4.0.0
|
| 121 |
*/
|
| 122 |
export declare const openUnsafe: (self: Latch) => boolean;
|
| 123 |
/**
|
| 124 |
-
* Releases
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
*
|
| 126 |
* @category combinators
|
| 127 |
* @since 4.0.0
|
|
@@ -132,40 +253,136 @@ export {
|
|
| 132 |
/**
|
| 133 |
* Waits for the latch to be opened.
|
| 134 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
* @category getters
|
| 136 |
* @since 4.0.0
|
| 137 |
*/
|
| 138 |
_await as await };
|
| 139 |
/**
|
| 140 |
-
* Closes the latch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
*
|
| 142 |
* @category combinators
|
| 143 |
* @since 4.0.0
|
| 144 |
*/
|
| 145 |
export declare const close: (self: Latch) => Effect.Effect<boolean>;
|
| 146 |
/**
|
| 147 |
-
* Closes the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
*
|
| 149 |
* @category unsafe
|
| 150 |
* @since 4.0.0
|
| 151 |
*/
|
| 152 |
export declare const closeUnsafe: (self: Latch) => boolean;
|
| 153 |
/**
|
| 154 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
*
|
| 156 |
* @category combinators
|
| 157 |
* @since 4.0.0
|
| 158 |
*/
|
| 159 |
export declare const whenOpen: {
|
| 160 |
/**
|
| 161 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
*
|
| 163 |
* @category combinators
|
| 164 |
* @since 4.0.0
|
| 165 |
*/
|
| 166 |
(self: Latch): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
| 167 |
/**
|
| 168 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
*
|
| 170 |
* @category combinators
|
| 171 |
* @since 4.0.0
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Reusable synchronization primitives for coordinating fibers. A `Latch` is
|
| 3 |
+
* either open or closed: when it is closed, `await` and `whenOpen` suspend
|
| 4 |
+
* until the latch opens or the current waiters are released. The module
|
| 5 |
+
* includes effectful and synchronous constructors plus helpers to open, release,
|
| 6 |
+
* close, wait, and gate effects behind the latch.
|
| 7 |
+
*
|
| 8 |
+
* @since 4.0.0
|
| 9 |
*/
|
| 10 |
import type * as Effect from "./Effect.ts";
|
| 11 |
/**
|
| 12 |
+
* A reusable coordination primitive that lets fibers wait until they are
|
| 13 |
+
* released by the latch.
|
| 14 |
+
*
|
| 15 |
+
* **When to use**
|
| 16 |
+
*
|
| 17 |
+
* Use to coordinate fibers that must wait for an explicit open or release
|
| 18 |
+
* signal before continuing.
|
| 19 |
+
*
|
| 20 |
+
* **Details**
|
| 21 |
+
*
|
| 22 |
+
* A closed latch causes `await` and `whenOpen` to suspend. `open` opens the
|
| 23 |
+
* latch and releases current and future waiters, `release` releases only
|
| 24 |
+
* current waiters without opening it, and `close` makes future waiters suspend
|
| 25 |
+
* again.
|
| 26 |
+
*
|
| 27 |
+
* **Example** (Coordinating fibers with a latch)
|
| 28 |
+
*
|
| 29 |
* ```ts
|
| 30 |
* import { Effect, Latch } from "effect"
|
| 31 |
*
|
|
|
|
| 39 |
* return "Latch was opened!"
|
| 40 |
* })
|
| 41 |
* ```
|
| 42 |
+
*
|
| 43 |
+
* @see {@link make} for creating a latch inside Effect code
|
| 44 |
+
* @see {@link open} for releasing current and future waiters
|
| 45 |
+
* @see {@link release} for releasing only the current waiters
|
| 46 |
+
*
|
| 47 |
+
* @category models
|
| 48 |
+
* @since 4.0.0
|
| 49 |
*/
|
| 50 |
export interface Latch {
|
| 51 |
+
/**
|
| 52 |
+
* Opens the latch, releasing all fibers waiting on it.
|
| 53 |
+
*
|
| 54 |
+
* **When to use**
|
| 55 |
+
*
|
| 56 |
+
* Use to let current and future waiters continue.
|
| 57 |
+
*/
|
| 58 |
readonly open: Effect.Effect<boolean>;
|
| 59 |
+
/**
|
| 60 |
+
* Opens the latch synchronously, releasing all fibers waiting on it.
|
| 61 |
+
*
|
| 62 |
+
* **When to use**
|
| 63 |
+
*
|
| 64 |
+
* Use when synchronous code must open the latch immediately.
|
| 65 |
+
*/
|
| 66 |
openUnsafe(this: Latch): boolean;
|
| 67 |
+
/**
|
| 68 |
+
* Releases all fibers currently waiting on the latch without opening it.
|
| 69 |
+
*
|
| 70 |
+
* **When to use**
|
| 71 |
+
*
|
| 72 |
+
* Use to let current waiters continue while future waiters still suspend.
|
| 73 |
+
*/
|
| 74 |
readonly release: Effect.Effect<boolean>;
|
| 75 |
+
/**
|
| 76 |
+
* Waits for the latch to be opened or released.
|
| 77 |
+
*
|
| 78 |
+
* **When to use**
|
| 79 |
+
*
|
| 80 |
+
* Use to suspend until the latch allows the current fiber to continue.
|
| 81 |
+
*/
|
| 82 |
readonly await: Effect.Effect<void>;
|
| 83 |
+
/**
|
| 84 |
+
* Closes the latch so future waiters suspend again.
|
| 85 |
+
*
|
| 86 |
+
* **When to use**
|
| 87 |
+
*
|
| 88 |
+
* Use to re-enable waiting after a latch has been opened.
|
| 89 |
+
*/
|
| 90 |
readonly close: Effect.Effect<boolean>;
|
| 91 |
+
/**
|
| 92 |
+
* Closes the latch synchronously so future waiters suspend again.
|
| 93 |
+
*
|
| 94 |
+
* **When to use**
|
| 95 |
+
*
|
| 96 |
+
* Use when synchronous code must close the latch immediately.
|
| 97 |
+
*/
|
| 98 |
closeUnsafe(this: Latch): boolean;
|
| 99 |
+
/**
|
| 100 |
+
* Runs the given effect only after the latch allows waiting fibers to
|
| 101 |
+
* continue.
|
| 102 |
+
*
|
| 103 |
+
* **When to use**
|
| 104 |
+
*
|
| 105 |
+
* Use to gate an effect behind the latch signal.
|
| 106 |
+
*/
|
| 107 |
whenOpen<A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R>;
|
| 108 |
}
|
| 109 |
/**
|
| 110 |
+
* Creates a `Latch` synchronously, outside of `Effect`.
|
| 111 |
+
*
|
| 112 |
+
* **When to use**
|
| 113 |
*
|
| 114 |
+
* Use when you need to allocate a `Latch` synchronously outside an Effect
|
| 115 |
+
* workflow.
|
| 116 |
*
|
| 117 |
+
* **Details**
|
| 118 |
*
|
| 119 |
+
* The latch starts closed by default; pass `true` to create it open.
|
| 120 |
+
*
|
| 121 |
+
* **Example** (Creating a latch unsafely)
|
| 122 |
*
|
|
|
|
| 123 |
* ```ts
|
| 124 |
* import { Effect, Latch } from "effect"
|
| 125 |
*
|
|
|
|
| 140 |
* const program = Effect.all([waiter, opener])
|
| 141 |
* ```
|
| 142 |
*
|
| 143 |
+
* @see {@link make} for creating a latch inside Effect code
|
| 144 |
+
*
|
| 145 |
* @category constructors
|
| 146 |
+
* @since 4.0.0
|
| 147 |
*/
|
| 148 |
export declare const makeUnsafe: (open?: boolean | undefined) => Latch;
|
| 149 |
/**
|
| 150 |
+
* Creates a `Latch` inside `Effect`.
|
| 151 |
*
|
| 152 |
+
* **When to use**
|
| 153 |
*
|
| 154 |
+
* Use to create a latch for coordinating fibers inside Effect code.
|
| 155 |
*
|
| 156 |
+
* **Details**
|
| 157 |
+
*
|
| 158 |
+
* The latch starts closed by default; pass `true` to create it open.
|
| 159 |
+
*
|
| 160 |
+
* **Example** (Creating a latch)
|
| 161 |
*
|
|
|
|
| 162 |
* ```ts
|
| 163 |
* import { Effect, Latch } from "effect"
|
| 164 |
*
|
|
|
|
| 181 |
* })
|
| 182 |
* ```
|
| 183 |
*
|
| 184 |
+
* @see {@link makeUnsafe} for synchronous allocation outside Effect code
|
| 185 |
+
*
|
| 186 |
* @category constructors
|
| 187 |
+
* @since 4.0.0
|
| 188 |
*/
|
| 189 |
export declare const make: (open?: boolean | undefined) => Effect.Effect<Latch>;
|
| 190 |
/**
|
| 191 |
+
* Opens the latch and releases fibers waiting on it.
|
| 192 |
+
*
|
| 193 |
+
* **When to use**
|
| 194 |
+
*
|
| 195 |
+
* Use to open a latch and release all fibers that are waiting on it.
|
| 196 |
+
*
|
| 197 |
+
* **Details**
|
| 198 |
+
*
|
| 199 |
+
* The returned effect succeeds with `true` when this call changed the latch
|
| 200 |
+
* from closed to open, or `false` if it was already open.
|
| 201 |
+
*
|
| 202 |
+
* @see {@link openUnsafe} for a synchronous variant
|
| 203 |
+
* @see {@link release} to release waiting fibers without opening the latch
|
| 204 |
*
|
| 205 |
* @category combinators
|
| 206 |
* @since 4.0.0
|
| 207 |
*/
|
| 208 |
export declare const open: (self: Latch) => Effect.Effect<boolean>;
|
| 209 |
/**
|
| 210 |
+
* Opens the latch synchronously and releases fibers waiting on it.
|
| 211 |
+
*
|
| 212 |
+
* **When to use**
|
| 213 |
+
*
|
| 214 |
+
* Use when you need synchronous code to open a latch immediately and release
|
| 215 |
+
* the fibers waiting on it.
|
| 216 |
+
*
|
| 217 |
+
* **Details**
|
| 218 |
+
*
|
| 219 |
+
* Returns `true` when this call changed the latch from closed to open, or
|
| 220 |
+
* `false` if it was already open. This unsafe variant performs the state
|
| 221 |
+
* change immediately instead of returning an `Effect`.
|
| 222 |
+
*
|
| 223 |
+
* @see {@link open} for the effectful variant
|
| 224 |
+
* @see {@link release} to release waiting fibers without opening the latch
|
| 225 |
+
* @see {@link closeUnsafe} for the synchronous inverse operation
|
| 226 |
*
|
| 227 |
* @category unsafe
|
| 228 |
* @since 4.0.0
|
| 229 |
*/
|
| 230 |
export declare const openUnsafe: (self: Latch) => boolean;
|
| 231 |
/**
|
| 232 |
+
* Releases the fibers currently waiting on a closed latch without opening it.
|
| 233 |
+
*
|
| 234 |
+
* **When to use**
|
| 235 |
+
*
|
| 236 |
+
* Use to let the fibers currently waiting on a latch proceed while keeping the
|
| 237 |
+
* latch closed for future waiters.
|
| 238 |
+
*
|
| 239 |
+
* **Details**
|
| 240 |
+
*
|
| 241 |
+
* The returned effect succeeds with `true` when release was requested while
|
| 242 |
+
* the latch was closed, or `false` if the latch was already open. Future
|
| 243 |
+
* waiters still suspend until the latch is opened or released again.
|
| 244 |
+
*
|
| 245 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 246 |
*
|
| 247 |
* @category combinators
|
| 248 |
* @since 4.0.0
|
|
|
|
| 253 |
/**
|
| 254 |
* Waits for the latch to be opened.
|
| 255 |
*
|
| 256 |
+
* **When to use**
|
| 257 |
+
*
|
| 258 |
+
* Use to suspend the current fiber until the latch is opened or the current
|
| 259 |
+
* set of waiters is released.
|
| 260 |
+
*
|
| 261 |
+
* **Details**
|
| 262 |
+
*
|
| 263 |
+
* Awaiting an already open latch completes immediately. Awaiting a closed
|
| 264 |
+
* latch suspends until `open` or `release` resumes the waiters.
|
| 265 |
+
*
|
| 266 |
+
* **Gotchas**
|
| 267 |
+
*
|
| 268 |
+
* `release` can resume current waiters without opening the latch, so later
|
| 269 |
+
* waiters may still suspend.
|
| 270 |
+
*
|
| 271 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 272 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 273 |
+
* @see {@link whenOpen} for waiting before running another effect
|
| 274 |
+
*
|
| 275 |
* @category getters
|
| 276 |
* @since 4.0.0
|
| 277 |
*/
|
| 278 |
_await as await };
|
| 279 |
/**
|
| 280 |
+
* Closes the latch so future `await` and `whenOpen` calls suspend.
|
| 281 |
+
*
|
| 282 |
+
* **When to use**
|
| 283 |
+
*
|
| 284 |
+
* Use to re-enable waiting on a latch after it was opened, so later `await`
|
| 285 |
+
* and `whenOpen` calls suspend again.
|
| 286 |
+
*
|
| 287 |
+
* **Details**
|
| 288 |
+
*
|
| 289 |
+
* The returned effect succeeds with `true` when this call changed the latch
|
| 290 |
+
* from open to closed, or `false` if it was already closed.
|
| 291 |
+
*
|
| 292 |
+
* @see {@link closeUnsafe} for a synchronous variant
|
| 293 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 294 |
*
|
| 295 |
* @category combinators
|
| 296 |
* @since 4.0.0
|
| 297 |
*/
|
| 298 |
export declare const close: (self: Latch) => Effect.Effect<boolean>;
|
| 299 |
/**
|
| 300 |
+
* Closes the latch synchronously so future `await` and `whenOpen` calls
|
| 301 |
+
* suspend.
|
| 302 |
+
*
|
| 303 |
+
* **When to use**
|
| 304 |
+
*
|
| 305 |
+
* Use to close a latch synchronously when the state change must happen outside
|
| 306 |
+
* an `Effect`.
|
| 307 |
+
*
|
| 308 |
+
* **Details**
|
| 309 |
+
*
|
| 310 |
+
* Returns `true` when this call changed the latch from open to closed, or
|
| 311 |
+
* `false` if it was already closed. This unsafe variant performs the state
|
| 312 |
+
* change immediately instead of returning an `Effect`.
|
| 313 |
+
*
|
| 314 |
+
* @see {@link close} for the effectful variant
|
| 315 |
+
* @see {@link openUnsafe} to synchronously open the latch and release waiting
|
| 316 |
+
* fibers
|
| 317 |
*
|
| 318 |
* @category unsafe
|
| 319 |
* @since 4.0.0
|
| 320 |
*/
|
| 321 |
export declare const closeUnsafe: (self: Latch) => boolean;
|
| 322 |
/**
|
| 323 |
+
* Waits on the latch, then runs the provided effect.
|
| 324 |
+
*
|
| 325 |
+
* **When to use**
|
| 326 |
+
*
|
| 327 |
+
* Use to gate another effect so it starts only after the latch is opened or
|
| 328 |
+
* the current waiters are released.
|
| 329 |
+
*
|
| 330 |
+
* **Details**
|
| 331 |
+
*
|
| 332 |
+
* If the latch is open, the effect runs immediately. If it is closed, the
|
| 333 |
+
* returned effect suspends until the latch is opened or the current waiters are
|
| 334 |
+
* released. The provided effect's success, failure, and requirements are
|
| 335 |
+
* preserved.
|
| 336 |
+
*
|
| 337 |
+
* @see `await` for waiting without running another effect
|
| 338 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 339 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 340 |
*
|
| 341 |
* @category combinators
|
| 342 |
* @since 4.0.0
|
| 343 |
*/
|
| 344 |
export declare const whenOpen: {
|
| 345 |
/**
|
| 346 |
+
* Waits on the latch, then runs the provided effect.
|
| 347 |
+
*
|
| 348 |
+
* **When to use**
|
| 349 |
+
*
|
| 350 |
+
* Use to gate another effect so it starts only after the latch is opened or
|
| 351 |
+
* the current waiters are released.
|
| 352 |
+
*
|
| 353 |
+
* **Details**
|
| 354 |
+
*
|
| 355 |
+
* If the latch is open, the effect runs immediately. If it is closed, the
|
| 356 |
+
* returned effect suspends until the latch is opened or the current waiters are
|
| 357 |
+
* released. The provided effect's success, failure, and requirements are
|
| 358 |
+
* preserved.
|
| 359 |
+
*
|
| 360 |
+
* @see `await` for waiting without running another effect
|
| 361 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 362 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 363 |
*
|
| 364 |
* @category combinators
|
| 365 |
* @since 4.0.0
|
| 366 |
*/
|
| 367 |
(self: Latch): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
| 368 |
/**
|
| 369 |
+
* Waits on the latch, then runs the provided effect.
|
| 370 |
+
*
|
| 371 |
+
* **When to use**
|
| 372 |
+
*
|
| 373 |
+
* Use to gate another effect so it starts only after the latch is opened or
|
| 374 |
+
* the current waiters are released.
|
| 375 |
+
*
|
| 376 |
+
* **Details**
|
| 377 |
+
*
|
| 378 |
+
* If the latch is open, the effect runs immediately. If it is closed, the
|
| 379 |
+
* returned effect suspends until the latch is opened or the current waiters are
|
| 380 |
+
* released. The provided effect's success, failure, and requirements are
|
| 381 |
+
* preserved.
|
| 382 |
+
*
|
| 383 |
+
* @see `await` for waiting without running another effect
|
| 384 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 385 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 386 |
*
|
| 387 |
* @category combinators
|
| 388 |
* @since 4.0.0
|
.opencode/node_modules/effect/dist/Latch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Latch.d.ts","sourceRoot":"","sources":["../src/Latch.ts"],"names":[],"mappings":"AAAA;;
|
|
|
|
| 1 |
+
{"version":3,"file":"Latch.d.ts","sourceRoot":"","sources":["../src/Latch.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,KAAK,MAAM,MA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C,CAAC,CAAA;CAQvE,CAAA"}
|
.opencode/node_modules/effect/dist/Latch.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
| 1 |
import * as internal from "./internal/effect.js";
|
| 2 |
/**
|
| 3 |
-
* Creates a
|
| 4 |
*
|
| 5 |
-
* **
|
| 6 |
*
|
| 7 |
-
*
|
|
|
|
| 8 |
*
|
| 9 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
*
|
| 11 |
-
* @example
|
| 12 |
* ```ts
|
| 13 |
* import { Effect, Latch } from "effect"
|
| 14 |
*
|
|
@@ -29,20 +33,25 @@ import * as internal from "./internal/effect.js";
|
|
| 29 |
* const program = Effect.all([waiter, opener])
|
| 30 |
* ```
|
| 31 |
*
|
|
|
|
|
|
|
| 32 |
* @category constructors
|
| 33 |
-
* @since
|
| 34 |
*/
|
| 35 |
export const makeUnsafe = internal.makeLatchUnsafe;
|
| 36 |
/**
|
| 37 |
-
* Creates a
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
*
|
| 39 |
-
* **
|
| 40 |
*
|
| 41 |
-
*
|
| 42 |
*
|
| 43 |
-
*
|
| 44 |
*
|
| 45 |
-
* @example
|
| 46 |
* ```ts
|
| 47 |
* import { Effect, Latch } from "effect"
|
| 48 |
*
|
|
@@ -65,26 +74,68 @@ export const makeUnsafe = internal.makeLatchUnsafe;
|
|
| 65 |
* })
|
| 66 |
* ```
|
| 67 |
*
|
|
|
|
|
|
|
| 68 |
* @category constructors
|
| 69 |
-
* @since
|
| 70 |
*/
|
| 71 |
export const make = internal.makeLatch;
|
| 72 |
/**
|
| 73 |
-
* Opens the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
*
|
| 75 |
* @category combinators
|
| 76 |
* @since 4.0.0
|
| 77 |
*/
|
| 78 |
export const open = self => self.open;
|
| 79 |
/**
|
| 80 |
-
* Opens the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
*
|
| 82 |
* @category unsafe
|
| 83 |
* @since 4.0.0
|
| 84 |
*/
|
| 85 |
export const openUnsafe = self => self.openUnsafe();
|
| 86 |
/**
|
| 87 |
-
* Releases
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
*
|
| 89 |
* @category combinators
|
| 90 |
* @since 4.0.0
|
|
@@ -95,26 +146,90 @@ export {
|
|
| 95 |
/**
|
| 96 |
* Waits for the latch to be opened.
|
| 97 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
* @category getters
|
| 99 |
* @since 4.0.0
|
| 100 |
*/
|
| 101 |
_await as await };
|
| 102 |
/**
|
| 103 |
-
* Closes the latch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
*
|
| 105 |
* @category combinators
|
| 106 |
* @since 4.0.0
|
| 107 |
*/
|
| 108 |
export const close = self => self.close;
|
| 109 |
/**
|
| 110 |
-
* Closes the latch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
*
|
| 112 |
* @category unsafe
|
| 113 |
* @since 4.0.0
|
| 114 |
*/
|
| 115 |
export const closeUnsafe = self => self.closeUnsafe();
|
| 116 |
/**
|
| 117 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
*
|
| 119 |
* @category combinators
|
| 120 |
* @since 4.0.0
|
|
|
|
| 1 |
import * as internal from "./internal/effect.js";
|
| 2 |
/**
|
| 3 |
+
* Creates a `Latch` synchronously, outside of `Effect`.
|
| 4 |
*
|
| 5 |
+
* **When to use**
|
| 6 |
*
|
| 7 |
+
* Use when you need to allocate a `Latch` synchronously outside an Effect
|
| 8 |
+
* workflow.
|
| 9 |
*
|
| 10 |
+
* **Details**
|
| 11 |
+
*
|
| 12 |
+
* The latch starts closed by default; pass `true` to create it open.
|
| 13 |
+
*
|
| 14 |
+
* **Example** (Creating a latch unsafely)
|
| 15 |
*
|
|
|
|
| 16 |
* ```ts
|
| 17 |
* import { Effect, Latch } from "effect"
|
| 18 |
*
|
|
|
|
| 33 |
* const program = Effect.all([waiter, opener])
|
| 34 |
* ```
|
| 35 |
*
|
| 36 |
+
* @see {@link make} for creating a latch inside Effect code
|
| 37 |
+
*
|
| 38 |
* @category constructors
|
| 39 |
+
* @since 4.0.0
|
| 40 |
*/
|
| 41 |
export const makeUnsafe = internal.makeLatchUnsafe;
|
| 42 |
/**
|
| 43 |
+
* Creates a `Latch` inside `Effect`.
|
| 44 |
+
*
|
| 45 |
+
* **When to use**
|
| 46 |
+
*
|
| 47 |
+
* Use to create a latch for coordinating fibers inside Effect code.
|
| 48 |
*
|
| 49 |
+
* **Details**
|
| 50 |
*
|
| 51 |
+
* The latch starts closed by default; pass `true` to create it open.
|
| 52 |
*
|
| 53 |
+
* **Example** (Creating a latch)
|
| 54 |
*
|
|
|
|
| 55 |
* ```ts
|
| 56 |
* import { Effect, Latch } from "effect"
|
| 57 |
*
|
|
|
|
| 74 |
* })
|
| 75 |
* ```
|
| 76 |
*
|
| 77 |
+
* @see {@link makeUnsafe} for synchronous allocation outside Effect code
|
| 78 |
+
*
|
| 79 |
* @category constructors
|
| 80 |
+
* @since 4.0.0
|
| 81 |
*/
|
| 82 |
export const make = internal.makeLatch;
|
| 83 |
/**
|
| 84 |
+
* Opens the latch and releases fibers waiting on it.
|
| 85 |
+
*
|
| 86 |
+
* **When to use**
|
| 87 |
+
*
|
| 88 |
+
* Use to open a latch and release all fibers that are waiting on it.
|
| 89 |
+
*
|
| 90 |
+
* **Details**
|
| 91 |
+
*
|
| 92 |
+
* The returned effect succeeds with `true` when this call changed the latch
|
| 93 |
+
* from closed to open, or `false` if it was already open.
|
| 94 |
+
*
|
| 95 |
+
* @see {@link openUnsafe} for a synchronous variant
|
| 96 |
+
* @see {@link release} to release waiting fibers without opening the latch
|
| 97 |
*
|
| 98 |
* @category combinators
|
| 99 |
* @since 4.0.0
|
| 100 |
*/
|
| 101 |
export const open = self => self.open;
|
| 102 |
/**
|
| 103 |
+
* Opens the latch synchronously and releases fibers waiting on it.
|
| 104 |
+
*
|
| 105 |
+
* **When to use**
|
| 106 |
+
*
|
| 107 |
+
* Use when you need synchronous code to open a latch immediately and release
|
| 108 |
+
* the fibers waiting on it.
|
| 109 |
+
*
|
| 110 |
+
* **Details**
|
| 111 |
+
*
|
| 112 |
+
* Returns `true` when this call changed the latch from closed to open, or
|
| 113 |
+
* `false` if it was already open. This unsafe variant performs the state
|
| 114 |
+
* change immediately instead of returning an `Effect`.
|
| 115 |
+
*
|
| 116 |
+
* @see {@link open} for the effectful variant
|
| 117 |
+
* @see {@link release} to release waiting fibers without opening the latch
|
| 118 |
+
* @see {@link closeUnsafe} for the synchronous inverse operation
|
| 119 |
*
|
| 120 |
* @category unsafe
|
| 121 |
* @since 4.0.0
|
| 122 |
*/
|
| 123 |
export const openUnsafe = self => self.openUnsafe();
|
| 124 |
/**
|
| 125 |
+
* Releases the fibers currently waiting on a closed latch without opening it.
|
| 126 |
+
*
|
| 127 |
+
* **When to use**
|
| 128 |
+
*
|
| 129 |
+
* Use to let the fibers currently waiting on a latch proceed while keeping the
|
| 130 |
+
* latch closed for future waiters.
|
| 131 |
+
*
|
| 132 |
+
* **Details**
|
| 133 |
+
*
|
| 134 |
+
* The returned effect succeeds with `true` when release was requested while
|
| 135 |
+
* the latch was closed, or `false` if the latch was already open. Future
|
| 136 |
+
* waiters still suspend until the latch is opened or released again.
|
| 137 |
+
*
|
| 138 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 139 |
*
|
| 140 |
* @category combinators
|
| 141 |
* @since 4.0.0
|
|
|
|
| 146 |
/**
|
| 147 |
* Waits for the latch to be opened.
|
| 148 |
*
|
| 149 |
+
* **When to use**
|
| 150 |
+
*
|
| 151 |
+
* Use to suspend the current fiber until the latch is opened or the current
|
| 152 |
+
* set of waiters is released.
|
| 153 |
+
*
|
| 154 |
+
* **Details**
|
| 155 |
+
*
|
| 156 |
+
* Awaiting an already open latch completes immediately. Awaiting a closed
|
| 157 |
+
* latch suspends until `open` or `release` resumes the waiters.
|
| 158 |
+
*
|
| 159 |
+
* **Gotchas**
|
| 160 |
+
*
|
| 161 |
+
* `release` can resume current waiters without opening the latch, so later
|
| 162 |
+
* waiters may still suspend.
|
| 163 |
+
*
|
| 164 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 165 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 166 |
+
* @see {@link whenOpen} for waiting before running another effect
|
| 167 |
+
*
|
| 168 |
* @category getters
|
| 169 |
* @since 4.0.0
|
| 170 |
*/
|
| 171 |
_await as await };
|
| 172 |
/**
|
| 173 |
+
* Closes the latch so future `await` and `whenOpen` calls suspend.
|
| 174 |
+
*
|
| 175 |
+
* **When to use**
|
| 176 |
+
*
|
| 177 |
+
* Use to re-enable waiting on a latch after it was opened, so later `await`
|
| 178 |
+
* and `whenOpen` calls suspend again.
|
| 179 |
+
*
|
| 180 |
+
* **Details**
|
| 181 |
+
*
|
| 182 |
+
* The returned effect succeeds with `true` when this call changed the latch
|
| 183 |
+
* from open to closed, or `false` if it was already closed.
|
| 184 |
+
*
|
| 185 |
+
* @see {@link closeUnsafe} for a synchronous variant
|
| 186 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 187 |
*
|
| 188 |
* @category combinators
|
| 189 |
* @since 4.0.0
|
| 190 |
*/
|
| 191 |
export const close = self => self.close;
|
| 192 |
/**
|
| 193 |
+
* Closes the latch synchronously so future `await` and `whenOpen` calls
|
| 194 |
+
* suspend.
|
| 195 |
+
*
|
| 196 |
+
* **When to use**
|
| 197 |
+
*
|
| 198 |
+
* Use to close a latch synchronously when the state change must happen outside
|
| 199 |
+
* an `Effect`.
|
| 200 |
+
*
|
| 201 |
+
* **Details**
|
| 202 |
+
*
|
| 203 |
+
* Returns `true` when this call changed the latch from open to closed, or
|
| 204 |
+
* `false` if it was already closed. This unsafe variant performs the state
|
| 205 |
+
* change immediately instead of returning an `Effect`.
|
| 206 |
+
*
|
| 207 |
+
* @see {@link close} for the effectful variant
|
| 208 |
+
* @see {@link openUnsafe} to synchronously open the latch and release waiting
|
| 209 |
+
* fibers
|
| 210 |
*
|
| 211 |
* @category unsafe
|
| 212 |
* @since 4.0.0
|
| 213 |
*/
|
| 214 |
export const closeUnsafe = self => self.closeUnsafe();
|
| 215 |
/**
|
| 216 |
+
* Waits on the latch, then runs the provided effect.
|
| 217 |
+
*
|
| 218 |
+
* **When to use**
|
| 219 |
+
*
|
| 220 |
+
* Use to gate another effect so it starts only after the latch is opened or
|
| 221 |
+
* the current waiters are released.
|
| 222 |
+
*
|
| 223 |
+
* **Details**
|
| 224 |
+
*
|
| 225 |
+
* If the latch is open, the effect runs immediately. If it is closed, the
|
| 226 |
+
* returned effect suspends until the latch is opened or the current waiters are
|
| 227 |
+
* released. The provided effect's success, failure, and requirements are
|
| 228 |
+
* preserved.
|
| 229 |
+
*
|
| 230 |
+
* @see `await` for waiting without running another effect
|
| 231 |
+
* @see {@link open} for opening the latch for current and future waiters
|
| 232 |
+
* @see {@link release} for resuming current waiters without opening the latch
|
| 233 |
*
|
| 234 |
* @category combinators
|
| 235 |
* @since 4.0.0
|
.opencode/node_modules/effect/dist/Latch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Latch.js","names":["internal","makeUnsafe","makeLatchUnsafe","make","makeLatch","open","self","openUnsafe","release","_await","await","close","closeUnsafe","whenOpen","args","length","effect"],"sources":["../src/Latch.ts"],"sourcesContent":[null],"mappings":"
|
|
|
|
| 1 |
+
{"version":3,"file":"Latch.js","names":["internal","makeUnsafe","makeLatchUnsafe","make","makeLatch","open","self","openUnsafe","release","_await","await","close","closeUnsafe","whenOpen","args","length","effect"],"sources":["../src/Latch.ts"],"sourcesContent":[null],"mappings":"AAUA,OAAO,KAAKA,QAAQ,MAAM,sBAAsB;AA2GhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,OAAO,MAAMC,UAAU,GAA0CD,QAAQ,CAACE,eAAe;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,OAAO,MAAMC,IAAI,GAAyDH,QAAQ,CAACI,SAAS;AAE5F;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,IAAI,GAAIC,IAAW,IAA6BA,IAAI,CAACD,IAAI;AAEtE;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAME,UAAU,GAAID,IAAW,IAAcA,IAAI,CAACC,UAAU,EAAE;AAErE;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,MAAMC,OAAO,GAAIF,IAAW,IAA6BA,IAAI,CAACE,OAAO;AAE5E,MAAMC,MAAM,GAAIH,IAAW,IAA0BA,IAAI,CAACI,KAAK;AAE/D;AACE;;;;;;;;;;;;;;;;;;;;;;;;;AAyBAD,MAAM,IAAIC,KAAK;AAGjB;;;;;;;;;;;;;;;;;;;AAmBA,OAAO,MAAMC,KAAK,GAAIL,IAAW,IAA6BA,IAAI,CAACK,KAAK;AAExE;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAO,MAAMC,WAAW,GAAIN,IAAW,IAAcA,IAAI,CAACM,WAAW,EAAE;AAEvE;;;;;;;;;;;;;;;;;;;;;;AAsBA,OAAO,MAAMC,QAAQ,GA+ChBA,CAAC,GAAGC,IAAgB,KAAI;EAC3B,IAAIA,IAAI,CAACC,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,CAACT,IAAI,CAAC,GAAGQ,IAAI;IACnB,OAAQE,MAAoC,IAAKV,IAAI,CAACO,QAAQ,CAACG,MAAM,CAAC;EACxE;EACA,MAAM,CAACV,IAAI,EAAEU,MAAM,CAAC,GAAGF,IAAI;EAC3B,OAAOR,IAAI,CAACO,QAAQ,CAACG,MAAM,CAAC;AAC9B,CAAS","ignoreList":[]}
|
.opencode/node_modules/effect/dist/Layer.d.ts
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
.opencode/node_modules/effect/dist/Layer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Layer.d.ts","sourceRoot":"","sources":["../src/Layer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,KAAK,OAAO,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,eAAe,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,KA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I,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;CAe1H,CAAA"}
|
.opencode/node_modules/effect/dist/Layer.js
CHANGED
|
@@ -11,18 +11,23 @@ import * as Scope from "./Scope.js";
|
|
| 11 |
import * as Tracer from "./Tracer.js";
|
| 12 |
const TypeId = "~effect/Layer";
|
| 13 |
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
/**
|
| 15 |
* Returns `true` if the specified value is a `Layer`, `false` otherwise.
|
| 16 |
*
|
| 17 |
-
*
|
|
|
|
| 18 |
* ```ts
|
| 19 |
-
* import { Effect, Layer
|
| 20 |
*
|
| 21 |
* class Database extends Context.Service<Database, {
|
| 22 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 23 |
* }>()("Database") {}
|
| 24 |
*
|
| 25 |
-
* const dbLayer = Layer.succeed(Database
|
| 26 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 27 |
* })
|
| 28 |
* const notALayer = { someProperty: "value" }
|
|
@@ -31,8 +36,8 @@ const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
| 31 |
* console.log(Layer.isLayer(notALayer)) // false
|
| 32 |
* ```
|
| 33 |
*
|
| 34 |
-
* @since 2.0.0
|
| 35 |
* @category getters
|
|
|
|
| 36 |
*/
|
| 37 |
export const isLayer = u => hasProperty(u, TypeId);
|
| 38 |
const LayerProto = {
|
|
@@ -51,14 +56,18 @@ const fromBuildUnsafe = build => {
|
|
| 51 |
return self;
|
| 52 |
};
|
| 53 |
/**
|
| 54 |
-
* Constructs a Layer from a function that uses a `MemoMap` and `Scope` to
|
|
|
|
|
|
|
|
|
|
| 55 |
*
|
| 56 |
* The function receives a `MemoMap` for memoization and a `Scope` for resource management.
|
| 57 |
* A child scope is created, and if the build fails, the child scope is closed.
|
| 58 |
*
|
| 59 |
-
*
|
|
|
|
| 60 |
* ```ts
|
| 61 |
-
* import { Effect, Layer
|
| 62 |
*
|
| 63 |
* class Database extends Context.Service<Database, {
|
| 64 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -73,23 +82,26 @@ const fromBuildUnsafe = build => {
|
|
| 73 |
* )
|
| 74 |
* ```
|
| 75 |
*
|
| 76 |
-
* @since 4.0.0
|
| 77 |
* @category constructors
|
|
|
|
| 78 |
*/
|
| 79 |
export const fromBuild = build => fromBuildUnsafe((memoMap, scope) => {
|
| 80 |
const layerScope = Scope.forkUnsafe(scope);
|
| 81 |
return internalEffect.onExit(build(memoMap, layerScope), exit => exit._tag === "Failure" ? Scope.close(layerScope, exit) : internalEffect.void);
|
| 82 |
});
|
| 83 |
/**
|
| 84 |
-
* Constructs a Layer from a function that uses a `MemoMap` and `Scope` to
|
| 85 |
-
* with automatic memoization.
|
|
|
|
|
|
|
| 86 |
*
|
| 87 |
* This is similar to `fromBuild` but provides automatic memoization of the layer construction.
|
| 88 |
* The layer will be memoized based on the provided `MemoMap`.
|
| 89 |
*
|
| 90 |
-
*
|
|
|
|
| 91 |
* ```ts
|
| 92 |
-
* import { Effect, Layer
|
| 93 |
*
|
| 94 |
* class Database extends Context.Service<Database, {
|
| 95 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -104,51 +116,65 @@ export const fromBuild = build => fromBuildUnsafe((memoMap, scope) => {
|
|
| 104 |
* )
|
| 105 |
* ```
|
| 106 |
*
|
| 107 |
-
* @since 4.0.0
|
| 108 |
* @category constructors
|
|
|
|
| 109 |
*/
|
| 110 |
export const fromBuildMemo = build => {
|
| 111 |
const self = fromBuild((memoMap, scope) => memoMap.getOrElseMemoize(self, scope, build));
|
| 112 |
return self;
|
| 113 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
class MemoMapImpl {
|
| 115 |
get [MemoMapTypeId]() {
|
| 116 |
return MemoMapTypeId;
|
| 117 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
map = /*#__PURE__*/new Map();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
getOrElseMemoize(layer, scope, build) {
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
return internalEffect.andThen(internalEffect.scopeAddFinalizerExit(scope, exit => entry.finalizer(exit)), entry.effect);
|
| 124 |
}
|
| 125 |
-
|
| 126 |
-
const deferred = Deferred.makeUnsafe();
|
| 127 |
-
const entry = {
|
| 128 |
-
observers: 1,
|
| 129 |
-
effect: Deferred.await(deferred),
|
| 130 |
-
finalizer: exit => internalEffect.suspend(() => {
|
| 131 |
-
entry.observers--;
|
| 132 |
-
if (entry.observers === 0) {
|
| 133 |
-
this.map.delete(layer);
|
| 134 |
-
return Scope.close(layerScope, exit);
|
| 135 |
-
}
|
| 136 |
-
return internalEffect.void;
|
| 137 |
-
})
|
| 138 |
-
};
|
| 139 |
-
this.map.set(layer, entry);
|
| 140 |
-
return internalEffect.scopeAddFinalizerExit(scope, entry.finalizer).pipe(internalEffect.flatMap(() => build(this, layerScope)), internalEffect.onExit(exit => {
|
| 141 |
-
entry.effect = exit;
|
| 142 |
-
return Deferred.done(deferred, exit);
|
| 143 |
-
}));
|
| 144 |
}
|
| 145 |
}
|
| 146 |
/**
|
| 147 |
-
* Constructs a `MemoMap`
|
|
|
|
|
|
|
| 148 |
*
|
| 149 |
-
* @example
|
| 150 |
* ```ts
|
| 151 |
-
* import { Effect, Layer
|
| 152 |
*
|
| 153 |
* class Database extends Context.Service<Database, {
|
| 154 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -159,7 +185,7 @@ class MemoMapImpl {
|
|
| 159 |
* const memoMap = Layer.makeMemoMapUnsafe()
|
| 160 |
* const scope = yield* Effect.scope
|
| 161 |
*
|
| 162 |
-
* const dbLayer = Layer.succeed(Database
|
| 163 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 164 |
* })
|
| 165 |
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
@@ -168,16 +194,35 @@ class MemoMapImpl {
|
|
| 168 |
* })
|
| 169 |
* ```
|
| 170 |
*
|
| 171 |
-
* @since 4.0.0
|
| 172 |
* @category memo map
|
|
|
|
| 173 |
*/
|
| 174 |
export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
| 175 |
/**
|
| 176 |
-
* Constructs a `MemoMap`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
*
|
| 178 |
-
* @example
|
| 179 |
* ```ts
|
| 180 |
-
* import { Effect, Layer
|
| 181 |
*
|
| 182 |
* class Database extends Context.Service<Database, {
|
| 183 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -188,7 +233,7 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
| 188 |
* const memoMap = yield* Layer.makeMemoMap
|
| 189 |
* const scope = yield* Effect.scope
|
| 190 |
*
|
| 191 |
-
* const dbLayer = Layer.succeed(Database
|
| 192 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 193 |
* })
|
| 194 |
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
@@ -197,18 +242,45 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
| 197 |
* })
|
| 198 |
* ```
|
| 199 |
*
|
| 200 |
-
* @since 2.0.0
|
| 201 |
* @category memo map
|
|
|
|
| 202 |
*/
|
| 203 |
export const makeMemoMap = /*#__PURE__*/internalEffect.sync(makeMemoMapUnsafe);
|
| 204 |
/**
|
| 205 |
-
*
|
|
|
|
|
|
|
| 206 |
*
|
| 207 |
-
*
|
| 208 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
*
|
| 210 |
-
* @since 3.13.0
|
| 211 |
* @category models
|
|
|
|
| 212 |
*/
|
| 213 |
export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer/CurrentMemoMap") {
|
| 214 |
static getOrCreate = /*#__PURE__*/Context.getOrElse(this, makeMemoMapUnsafe);
|
|
@@ -217,9 +289,10 @@ export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer
|
|
| 217 |
* Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
|
| 218 |
* the layer construction.
|
| 219 |
*
|
| 220 |
-
*
|
|
|
|
| 221 |
* ```ts
|
| 222 |
-
* import { Effect, Layer
|
| 223 |
*
|
| 224 |
* class Database extends Context.Service<Database, {
|
| 225 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -235,13 +308,13 @@ export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer
|
|
| 235 |
* const scope = yield* Effect.scope
|
| 236 |
*
|
| 237 |
* // Build database layer with memoization
|
| 238 |
-
* const dbLayer = Layer.succeed(Database
|
| 239 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 240 |
* })
|
| 241 |
* const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
| 242 |
*
|
| 243 |
* // Build logger layer with same memoization (reuses memo if same layer)
|
| 244 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 245 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 246 |
* })
|
| 247 |
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
@@ -257,16 +330,17 @@ export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer
|
|
| 257 |
* })
|
| 258 |
* ```
|
| 259 |
*
|
| 260 |
-
* @since 2.0.0
|
| 261 |
* @category memo map
|
|
|
|
| 262 |
*/
|
| 263 |
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope), Context.add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
|
| 264 |
/**
|
| 265 |
* Builds a layer into a scoped value.
|
| 266 |
*
|
| 267 |
-
*
|
|
|
|
| 268 |
* ```ts
|
| 269 |
-
* import { Effect, Layer
|
| 270 |
*
|
| 271 |
* class Database extends Context.Service<Database, {
|
| 272 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -274,7 +348,7 @@ export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => i
|
|
| 274 |
*
|
| 275 |
* // Build a layer to get its services
|
| 276 |
* const program = Effect.gen(function*() {
|
| 277 |
-
* const dbLayer = Layer.succeed(Database
|
| 278 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 279 |
* })
|
| 280 |
*
|
|
@@ -288,20 +362,27 @@ export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => i
|
|
| 288 |
* })
|
| 289 |
* ```
|
| 290 |
*
|
| 291 |
-
* @since 2.0.0
|
| 292 |
* @category destructors
|
|
|
|
| 293 |
*/
|
| 294 |
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), Context.getUnsafe(fiber.context, Scope.Scope)));
|
| 295 |
/**
|
| 296 |
-
* Builds a layer
|
| 297 |
-
*
|
| 298 |
-
*
|
| 299 |
-
*
|
| 300 |
-
* layer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
*
|
| 302 |
-
* @example
|
| 303 |
* ```ts
|
| 304 |
-
* import { Effect, Layer, Scope
|
| 305 |
*
|
| 306 |
* class Database extends Context.Service<Database, {
|
| 307 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -311,7 +392,7 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
| 311 |
* const program = Effect.gen(function*() {
|
| 312 |
* const scope = yield* Effect.scope
|
| 313 |
*
|
| 314 |
-
* const dbLayer = Layer.effect(Database
|
| 315 |
* console.log("Initializing database...")
|
| 316 |
* yield* Scope.addFinalizer(
|
| 317 |
* scope,
|
|
@@ -329,51 +410,37 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
| 329 |
* })
|
| 330 |
* ```
|
| 331 |
*
|
| 332 |
-
* @since 2.0.0
|
| 333 |
* @category destructors
|
|
|
|
| 334 |
*/
|
| 335 |
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), scope)));
|
| 336 |
/**
|
| 337 |
-
* Constructs a layer from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
*
|
| 339 |
-
* @example
|
| 340 |
* ```ts
|
| 341 |
-
* import { Effect, Layer
|
| 342 |
*
|
| 343 |
* class Database extends Context.Service<Database, {
|
| 344 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 345 |
* }>()("Database") {}
|
| 346 |
*
|
| 347 |
-
*
|
| 348 |
-
* readonly log: (msg: string) => Effect.Effect<void>
|
| 349 |
-
* }>()("Logger") {}
|
| 350 |
-
*
|
| 351 |
-
* // Create layers from concrete service implementations
|
| 352 |
-
* const databaseLayer = Layer.succeed(Database)({
|
| 353 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
| 354 |
* })
|
| 355 |
-
*
|
| 356 |
-
* const loggerLayer = Layer.succeed(Logger)({
|
| 357 |
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
| 358 |
-
* })
|
| 359 |
-
*
|
| 360 |
-
* // Use the layers in a program
|
| 361 |
-
* const program = Effect.gen(function*() {
|
| 362 |
-
* const database = yield* Database
|
| 363 |
-
* const logger = yield* Logger
|
| 364 |
-
*
|
| 365 |
-
* yield* logger.log("Starting database query")
|
| 366 |
-
* const result = yield* database.query("SELECT * FROM users")
|
| 367 |
-
* yield* logger.log(`Query completed: ${result}`)
|
| 368 |
-
*
|
| 369 |
-
* return result
|
| 370 |
-
* }).pipe(
|
| 371 |
-
* Effect.provide(Layer.mergeAll(databaseLayer, loggerLayer))
|
| 372 |
-
* )
|
| 373 |
* ```
|
| 374 |
*
|
| 375 |
-
* @
|
|
|
|
| 376 |
* @category constructors
|
|
|
|
| 377 |
*/
|
| 378 |
export const succeed = function () {
|
| 379 |
if (arguments.length === 1) {
|
|
@@ -382,15 +449,23 @@ export const succeed = function () {
|
|
| 382 |
return succeedContext(Context.make(arguments[0], arguments[1]));
|
| 383 |
};
|
| 384 |
/**
|
| 385 |
-
* Constructs a layer
|
| 386 |
-
*
|
|
|
|
|
|
|
| 387 |
*
|
| 388 |
-
*
|
| 389 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
*
|
| 391 |
-
* @example
|
| 392 |
* ```ts
|
| 393 |
-
* import { Effect, Layer
|
| 394 |
*
|
| 395 |
* class Database extends Context.Service<Database, {
|
| 396 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -411,48 +486,69 @@ export const succeed = function () {
|
|
| 411 |
* const layer = Layer.succeedContext(context)
|
| 412 |
* ```
|
| 413 |
*
|
| 414 |
-
* @
|
|
|
|
| 415 |
* @category constructors
|
|
|
|
| 416 |
*/
|
| 417 |
export const succeedContext = context => fromBuildUnsafe(constant(internalEffect.succeed(context)));
|
| 418 |
/**
|
| 419 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
*
|
| 421 |
-
*
|
| 422 |
-
* in layer composition or as a starting point for building layers.
|
| 423 |
*
|
| 424 |
-
* @example
|
| 425 |
* ```ts
|
| 426 |
-
* import { Layer } from "effect"
|
|
|
|
|
|
|
| 427 |
*
|
| 428 |
-
* const
|
|
|
|
|
|
|
| 429 |
* ```
|
| 430 |
*
|
| 431 |
-
* @
|
|
|
|
| 432 |
* @category constructors
|
|
|
|
| 433 |
*/
|
| 434 |
export const empty = /*#__PURE__*/succeedContext(/*#__PURE__*/Context.empty());
|
| 435 |
/**
|
| 436 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
*
|
| 438 |
* This is a lazy version of `succeed` where the service value is computed
|
| 439 |
* synchronously only when the layer is built.
|
| 440 |
*
|
| 441 |
-
*
|
|
|
|
| 442 |
* ```ts
|
| 443 |
-
* import { Effect, Layer
|
| 444 |
*
|
| 445 |
* class Database extends Context.Service<Database, {
|
| 446 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 447 |
* }>()("Database") {}
|
| 448 |
*
|
| 449 |
-
* const layer = Layer.sync(Database
|
| 450 |
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
| 451 |
* }))
|
| 452 |
* ```
|
| 453 |
*
|
| 454 |
-
* @
|
|
|
|
| 455 |
* @category constructors
|
|
|
|
| 456 |
*/
|
| 457 |
export const sync = function () {
|
| 458 |
if (arguments.length === 1) {
|
|
@@ -461,15 +557,22 @@ export const sync = function () {
|
|
| 461 |
return syncContext(() => Context.make(arguments[0], arguments[1]()));
|
| 462 |
};
|
| 463 |
/**
|
| 464 |
-
*
|
| 465 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 466 |
*
|
| 467 |
-
* This is a lazy version of `succeedContext` where the Context is computed
|
| 468 |
* synchronously only when the layer is built.
|
| 469 |
*
|
| 470 |
-
*
|
|
|
|
| 471 |
* ```ts
|
| 472 |
-
* import { Effect, Layer
|
| 473 |
*
|
| 474 |
* class Database extends Context.Service<Database, {
|
| 475 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -482,40 +585,48 @@ export const sync = function () {
|
|
| 482 |
* )
|
| 483 |
* ```
|
| 484 |
*
|
| 485 |
-
* @
|
|
|
|
|
|
|
| 486 |
* @category constructors
|
|
|
|
| 487 |
*/
|
| 488 |
export const syncContext = evaluate => fromBuildMemo(constant(internalEffect.sync(evaluate)));
|
| 489 |
/**
|
| 490 |
-
* Constructs a layer from
|
| 491 |
*
|
| 492 |
-
*
|
| 493 |
-
* The Effect is executed in the scope of the layer, allowing for proper
|
| 494 |
-
* resource management.
|
| 495 |
*
|
| 496 |
-
*
|
|
|
|
| 497 |
*
|
| 498 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
*
|
| 500 |
-
*
|
| 501 |
*
|
| 502 |
-
* @example
|
| 503 |
* ```ts
|
| 504 |
-
* import { Effect, Layer
|
| 505 |
*
|
| 506 |
* class Database extends Context.Service<Database, {
|
| 507 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 508 |
* }>()("Database") {}
|
| 509 |
*
|
| 510 |
-
* const layer = Layer.effect(Database
|
| 511 |
* Effect.sync(() => ({
|
| 512 |
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
| 513 |
* }))
|
| 514 |
* )
|
| 515 |
* ```
|
| 516 |
*
|
| 517 |
-
* @
|
|
|
|
|
|
|
| 518 |
* @category constructors
|
|
|
|
| 519 |
*/
|
| 520 |
export const effect = function () {
|
| 521 |
if (arguments.length === 1) {
|
|
@@ -525,15 +636,23 @@ export const effect = function () {
|
|
| 525 |
};
|
| 526 |
const effectImpl = (service, effect) => effectContext(internalEffect.map(effect, value => Context.make(service, value)));
|
| 527 |
/**
|
| 528 |
-
* Constructs a layer from
|
| 529 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
*
|
| 531 |
-
*
|
| 532 |
-
* multiple services. The Effect is executed in the scope of the layer.
|
| 533 |
*
|
| 534 |
-
* @example
|
| 535 |
* ```ts
|
| 536 |
-
* import { Effect, Layer
|
| 537 |
*
|
| 538 |
* class Database extends Context.Service<
|
| 539 |
* Database,
|
|
@@ -547,23 +666,23 @@ const effectImpl = (service, effect) => effectContext(internalEffect.map(effect,
|
|
| 547 |
* )
|
| 548 |
* ```
|
| 549 |
*
|
| 550 |
-
* @
|
|
|
|
| 551 |
* @category constructors
|
|
|
|
| 552 |
*/
|
| 553 |
export const effectContext = effect => fromBuildMemo((_, scope) => Scope.provide(effect, scope));
|
| 554 |
/**
|
| 555 |
-
* Constructs a layer from
|
| 556 |
-
*
|
| 557 |
-
* This is useful when you want to run an Effect for its side effects during
|
| 558 |
-
* layer construction, but don't need to provide any services.
|
| 559 |
*
|
| 560 |
-
* **
|
| 561 |
*
|
| 562 |
-
*
|
|
|
|
| 563 |
*
|
| 564 |
-
*
|
| 565 |
*
|
| 566 |
-
* @example
|
| 567 |
* ```ts
|
| 568 |
* import { Effect, Layer } from "effect"
|
| 569 |
*
|
|
@@ -574,19 +693,24 @@ export const effectContext = effect => fromBuildMemo((_, scope) => Scope.provide
|
|
| 574 |
* )
|
| 575 |
* ```
|
| 576 |
*
|
| 577 |
-
* @
|
|
|
|
| 578 |
* @category constructors
|
|
|
|
| 579 |
*/
|
| 580 |
export const effectDiscard = effect => effectContext(internalEffect.as(effect, Context.empty()));
|
| 581 |
/**
|
| 582 |
-
*
|
|
|
|
|
|
|
| 583 |
*
|
| 584 |
* The factory is evaluated only when the suspended layer is first built, and
|
| 585 |
* the result is memoized with normal layer sharing semantics.
|
| 586 |
*
|
| 587 |
-
*
|
|
|
|
| 588 |
* ```ts
|
| 589 |
-
* import {
|
| 590 |
*
|
| 591 |
* class Config extends Context.Service<Config, string>()("Config") {}
|
| 592 |
*
|
|
@@ -594,39 +718,46 @@ export const effectDiscard = effect => effectContext(internalEffect.as(effect, C
|
|
| 594 |
*
|
| 595 |
* const layer = Layer.suspend(() =>
|
| 596 |
* useProd
|
| 597 |
-
* ? Layer.succeed(Config
|
| 598 |
-
* : Layer.succeed(Config
|
| 599 |
* )
|
| 600 |
* ```
|
| 601 |
*
|
| 602 |
-
* @since 4.0.0
|
| 603 |
* @category constructors
|
|
|
|
| 604 |
*/
|
| 605 |
export const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)));
|
| 606 |
/**
|
| 607 |
-
* Unwraps a Layer from an Effect, flattening the nested structure.
|
|
|
|
|
|
|
| 608 |
*
|
| 609 |
-
*
|
| 610 |
-
* use that
|
| 611 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
*
|
| 613 |
-
* @example
|
| 614 |
* ```ts
|
| 615 |
-
* import { Effect, Layer
|
| 616 |
*
|
| 617 |
* class Database extends Context.Service<Database, {
|
| 618 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 619 |
* }>()("Database") {}
|
| 620 |
*
|
| 621 |
* const layerEffect = Effect.succeed(
|
| 622 |
-
* Layer.succeed(Database
|
| 623 |
* )
|
| 624 |
*
|
| 625 |
* const unwrappedLayer = Layer.unwrap(layerEffect)
|
| 626 |
* ```
|
| 627 |
*
|
|
|
|
| 628 |
* @since 4.0.0
|
| 629 |
-
* @category utils
|
| 630 |
*/
|
| 631 |
export const unwrap = self => {
|
| 632 |
const service = Context.Service("effect/Layer/unwrap");
|
|
@@ -639,14 +770,25 @@ const mergeAllEffect = (layers, memoMap, scope) => {
|
|
| 639 |
}).pipe(internalEffect.map(context => Context.mergeAll(...context)));
|
| 640 |
};
|
| 641 |
/**
|
| 642 |
-
* Combines all the provided layers concurrently, creating a new layer with
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
*
|
| 644 |
* All layers are built concurrently, and their outputs are merged into a single layer.
|
| 645 |
-
* This is useful when you need to combine multiple independent layers.
|
| 646 |
*
|
| 647 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
* ```ts
|
| 649 |
-
* import { Effect, Layer
|
| 650 |
*
|
| 651 |
* class Database extends Context.Service<Database, {
|
| 652 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -656,29 +798,41 @@ const mergeAllEffect = (layers, memoMap, scope) => {
|
|
| 656 |
* readonly log: (msg: string) => Effect.Effect<void>
|
| 657 |
* }>()("Logger") {}
|
| 658 |
*
|
| 659 |
-
* const dbLayer = Layer.succeed(Database
|
| 660 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 661 |
* })
|
| 662 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 663 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 664 |
* })
|
| 665 |
*
|
| 666 |
* const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
|
| 667 |
* ```
|
| 668 |
*
|
| 669 |
-
* @
|
|
|
|
| 670 |
* @category zipping
|
|
|
|
| 671 |
*/
|
| 672 |
export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
|
| 673 |
/**
|
| 674 |
-
* Merges this layer with
|
|
|
|
|
|
|
|
|
|
| 675 |
*
|
| 676 |
-
*
|
| 677 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 678 |
*
|
| 679 |
-
* @example
|
| 680 |
* ```ts
|
| 681 |
-
* import { Effect, Layer
|
| 682 |
*
|
| 683 |
* class Database extends Context.Service<Database, {
|
| 684 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -688,29 +842,40 @@ export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEff
|
|
| 688 |
* readonly log: (msg: string) => Effect.Effect<void>
|
| 689 |
* }>()("Logger") {}
|
| 690 |
*
|
| 691 |
-
* const dbLayer = Layer.succeed(Database
|
| 692 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 693 |
* })
|
| 694 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 695 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 696 |
* })
|
| 697 |
*
|
| 698 |
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
| 699 |
* ```
|
| 700 |
*
|
| 701 |
-
* @
|
|
|
|
| 702 |
* @category zipping
|
|
|
|
| 703 |
*/
|
| 704 |
export const merge = /*#__PURE__*/dual(2, (self, that) => mergeAll(self, ...(Array.isArray(that) ? that : [that])));
|
| 705 |
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.provideContext(context), internalEffect.map(merged => f(merged, context)))));
|
| 706 |
/**
|
| 707 |
-
* Feeds the output services of
|
| 708 |
-
*
|
| 709 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 710 |
*
|
| 711 |
-
* @example
|
| 712 |
* ```ts
|
| 713 |
-
* import { Effect, Layer
|
| 714 |
*
|
| 715 |
* class Database extends Context.Service<Database, {
|
| 716 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -728,16 +893,16 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEff
|
|
| 728 |
* }>()("Logger") {}
|
| 729 |
*
|
| 730 |
* // Create dependency layers
|
| 731 |
-
* const databaseLayer = Layer.succeed(Database
|
| 732 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
| 733 |
* })
|
| 734 |
*
|
| 735 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 736 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
| 737 |
* })
|
| 738 |
*
|
| 739 |
* // UserService depends on Database and Logger
|
| 740 |
-
* const userServiceLayer = Layer.effect(UserService
|
| 741 |
* const database = yield* Database
|
| 742 |
* const logger = yield* Logger
|
| 743 |
*
|
|
@@ -766,18 +931,29 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEff
|
|
| 766 |
* )
|
| 767 |
* ```
|
| 768 |
*
|
|
|
|
|
|
|
|
|
|
| 769 |
* @since 2.0.0
|
| 770 |
-
* @category utils
|
| 771 |
*/
|
| 772 |
export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, identity));
|
| 773 |
/**
|
| 774 |
-
* Feeds the output services of
|
| 775 |
-
* layer,
|
| 776 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 777 |
*
|
| 778 |
-
* @example
|
| 779 |
* ```ts
|
| 780 |
-
* import { Effect, Layer
|
| 781 |
*
|
| 782 |
* class Database extends Context.Service<Database, {
|
| 783 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -795,16 +971,16 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
| 795 |
* }>()("UserService") {}
|
| 796 |
*
|
| 797 |
* // Create dependency layers
|
| 798 |
-
* const databaseLayer = Layer.succeed(Database
|
| 799 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
| 800 |
* })
|
| 801 |
*
|
| 802 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 803 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
| 804 |
* })
|
| 805 |
*
|
| 806 |
* // UserService depends on Database and Logger
|
| 807 |
-
* const userServiceLayer = Layer.effect(UserService
|
| 808 |
* const database = yield* Database
|
| 809 |
* const logger = yield* Logger
|
| 810 |
*
|
|
@@ -839,16 +1015,19 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
| 839 |
* )
|
| 840 |
* ```
|
| 841 |
*
|
|
|
|
|
|
|
|
|
|
| 842 |
* @since 2.0.0
|
| 843 |
-
* @category utils
|
| 844 |
*/
|
| 845 |
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) => Context.merge(that, self)));
|
| 846 |
/**
|
| 847 |
* Constructs a layer dynamically based on the output of this layer.
|
| 848 |
*
|
| 849 |
-
*
|
|
|
|
| 850 |
* ```ts
|
| 851 |
-
* import { Effect, Layer
|
| 852 |
*
|
| 853 |
* class Config extends Context.Service<Config, {
|
| 854 |
* readonly dbUrl: string
|
|
@@ -864,7 +1043,7 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
| 864 |
* }>()("Logger") {}
|
| 865 |
*
|
| 866 |
* // Base config layer
|
| 867 |
-
* const configLayer = Layer.succeed(Config
|
| 868 |
* dbUrl: "postgres://localhost:5432/mydb",
|
| 869 |
* logLevel: "debug"
|
| 870 |
* })
|
|
@@ -875,7 +1054,7 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
| 875 |
* const config = Context.get(context, Config)
|
| 876 |
*
|
| 877 |
* // Create database layer based on config
|
| 878 |
-
* const dbLayer = Layer.succeed(Database
|
| 879 |
* query: Effect.fn("Database.query")((sql: string) =>
|
| 880 |
* Effect.succeed(
|
| 881 |
* `Querying ${config.dbUrl}: ${sql}`
|
|
@@ -883,7 +1062,7 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
| 883 |
* })
|
| 884 |
*
|
| 885 |
* // Create logger layer based on config
|
| 886 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 887 |
* log: Effect.fn("Logger.log")((msg: string) =>
|
| 888 |
* config.logLevel === "debug"
|
| 889 |
* ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
|
|
@@ -910,44 +1089,87 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
| 910 |
* )
|
| 911 |
* ```
|
| 912 |
*
|
| 913 |
-
* @since 2.0.0
|
| 914 |
* @category sequencing
|
|
|
|
| 915 |
*/
|
| 916 |
export const flatMap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => f(context).build(memoMap, scope))));
|
| 917 |
/**
|
| 918 |
* Performs the specified effect if this layer succeeds.
|
| 919 |
*
|
| 920 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 921 |
* @category sequencing
|
|
|
|
| 922 |
*/
|
| 923 |
export const tap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => Scope.provide(internalEffect.as(f(context), context), scope))));
|
| 924 |
/**
|
| 925 |
* Performs the specified effect if this layer fails.
|
| 926 |
*
|
| 927 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 928 |
* @category sequencing
|
|
|
|
| 929 |
*/
|
| 930 |
export const tapError = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catch_(self.build(memoMap, scope), error => Scope.provide(internalEffect.andThen(f(error), internalEffect.fail(error)), scope))));
|
| 931 |
/**
|
| 932 |
-
* Performs the specified effect
|
| 933 |
*
|
| 934 |
-
* **
|
| 935 |
*
|
| 936 |
-
*
|
|
|
|
| 937 |
*
|
| 938 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 939 |
*
|
| 940 |
-
* @since 4.0.0
|
| 941 |
* @category sequencing
|
|
|
|
| 942 |
*/
|
| 943 |
export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catchCause(self.build(memoMap, scope), cause => Scope.provide(internalEffect.andThen(f(cause), internalEffect.failCause(cause)), scope))));
|
| 944 |
/**
|
| 945 |
-
*
|
| 946 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 947 |
*
|
| 948 |
-
* @example
|
| 949 |
* ```ts
|
| 950 |
-
* import { Data, Effect, Layer
|
| 951 |
*
|
| 952 |
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
| 953 |
* message: string
|
|
@@ -958,14 +1180,9 @@ export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, sc
|
|
| 958 |
* }>()("Database") {}
|
| 959 |
*
|
| 960 |
* // Layer that can fail during construction
|
| 961 |
-
* const flakyDatabaseLayer = Layer.effect(Database
|
| 962 |
-
*
|
| 963 |
-
*
|
| 964 |
-
* if (shouldFail) {
|
| 965 |
-
* return yield* new DatabaseError({ message: "Connection failed" })
|
| 966 |
-
* }
|
| 967 |
-
*
|
| 968 |
-
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
| 969 |
* }))
|
| 970 |
*
|
| 971 |
* // Convert failures to fiber death - removes error from type
|
|
@@ -979,29 +1196,42 @@ export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, sc
|
|
| 979 |
* Effect.provide(reliableDatabaseLayer)
|
| 980 |
* )
|
| 981 |
*
|
| 982 |
-
* //
|
| 983 |
-
* // instead of
|
| 984 |
* ```
|
| 985 |
*
|
| 986 |
-
* @since 2.0.0
|
| 987 |
* @category error handling
|
|
|
|
| 988 |
*/
|
| 989 |
export const orDie = self => fromBuildUnsafe((memoMap, scope) => internalEffect.orDie(self.build(memoMap, scope)));
|
| 990 |
const catch_ = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => internalEffect.catch_(self.build(memoMap, scope), e => onError(e).build(memoMap, scope))));
|
| 991 |
export {
|
| 992 |
/**
|
| 993 |
-
* Recovers from all errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 994 |
*
|
| 995 |
-
* @since 4.0.0
|
| 996 |
* @category error handling
|
|
|
|
| 997 |
*/
|
| 998 |
catch_ as catch };
|
| 999 |
/**
|
| 1000 |
* Recovers from specific tagged errors.
|
| 1001 |
*
|
| 1002 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1003 |
* ```ts
|
| 1004 |
-
* import { Data, Effect, Layer
|
| 1005 |
*
|
| 1006 |
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
| 1007 |
*
|
|
@@ -1009,80 +1239,87 @@ catch_ as catch };
|
|
| 1009 |
* readonly apiUrl: string
|
| 1010 |
* }>()("Config") {}
|
| 1011 |
*
|
| 1012 |
-
* const configLayer = Layer.effect(Config
|
| 1013 |
*
|
| 1014 |
-
* const fallbackLayer = Layer.succeed(Config
|
| 1015 |
*
|
| 1016 |
* const recovered = configLayer.pipe(
|
| 1017 |
* Layer.catchTag("ConfigError", () => fallbackLayer)
|
| 1018 |
* )
|
| 1019 |
* ```
|
| 1020 |
*
|
| 1021 |
-
* @
|
|
|
|
| 1022 |
* @category error handling
|
|
|
|
| 1023 |
*/
|
| 1024 |
export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((memoMap, scope) => internalEffect.catchTag(self.build(memoMap, scope), k, error => f(error).build(memoMap, scope))));
|
| 1025 |
/**
|
| 1026 |
-
* Recovers from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1027 |
*
|
| 1028 |
-
* @example
|
| 1029 |
* ```ts
|
| 1030 |
-
* import { Data, Effect, Layer
|
| 1031 |
*
|
| 1032 |
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
| 1033 |
* message: string
|
| 1034 |
* }> {}
|
| 1035 |
*
|
| 1036 |
-
* class NetworkError extends Data.TaggedError("NetworkError")<{
|
| 1037 |
-
* reason: string
|
| 1038 |
-
* }> {}
|
| 1039 |
-
*
|
| 1040 |
* class Database extends Context.Service<Database, {
|
| 1041 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 1042 |
* }>()("Database") {}
|
| 1043 |
*
|
| 1044 |
-
*
|
| 1045 |
-
*
|
| 1046 |
-
*
|
| 1047 |
-
*
|
| 1048 |
-
* // Primary database layer that might fail
|
| 1049 |
-
* const primaryDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
|
| 1050 |
-
* return yield* new DatabaseError({ message: "Primary DB unreachable" })
|
| 1051 |
-
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Primary: ${sql}`)) }
|
| 1052 |
-
* }))
|
| 1053 |
*
|
| 1054 |
-
* // Fallback layers for different error causes
|
| 1055 |
* const databaseWithFallback = primaryDatabaseLayer.pipe(
|
| 1056 |
* Layer.catchCause(() => {
|
| 1057 |
-
*
|
| 1058 |
-
*
|
| 1059 |
-
*
|
| 1060 |
-
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
|
| 1061 |
-
* }),
|
| 1062 |
-
* Layer.succeed(Logger)({
|
| 1063 |
-
* log: Effect.fn("Logger.log")((msg: string) =>
|
| 1064 |
-
* Effect.sync(() => console.log(`[FALLBACK] ${msg}`))
|
| 1065 |
-
* )
|
| 1066 |
-
* })
|
| 1067 |
-
* )
|
| 1068 |
* })
|
| 1069 |
* )
|
| 1070 |
*
|
| 1071 |
* const program = Effect.gen(function*() {
|
| 1072 |
* const database = yield* Database
|
| 1073 |
-
*
|
|
|
|
| 1074 |
* }).pipe(
|
| 1075 |
* Effect.provide(databaseWithFallback)
|
| 1076 |
* )
|
|
|
|
|
|
|
|
|
|
| 1077 |
* ```
|
| 1078 |
*
|
| 1079 |
-
* @
|
|
|
|
| 1080 |
* @category error handling
|
|
|
|
| 1081 |
*/
|
| 1082 |
export const catchCause = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => internalEffect.catchCause(self.build(memoMap, scope), cause => onError(cause).build(memoMap, scope))));
|
| 1083 |
/**
|
| 1084 |
* Updates a service in the context with a new implementation.
|
| 1085 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1086 |
* **Details**
|
| 1087 |
*
|
| 1088 |
* This function modifies the existing implementation of a service in the
|
|
@@ -1090,74 +1327,110 @@ export const catchCause = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsaf
|
|
| 1090 |
* transformation function `f`, and replaces the old service with the
|
| 1091 |
* transformed one.
|
| 1092 |
*
|
| 1093 |
-
*
|
| 1094 |
-
*
|
| 1095 |
-
* This is useful for adapting or extending a service's behavior during the
|
| 1096 |
-
* creation of a layer.
|
| 1097 |
-
*
|
| 1098 |
* @since 3.13.0
|
| 1099 |
-
* @category utils
|
| 1100 |
*/
|
| 1101 |
-
export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide(layer, effect(service, internalEffect.map(service
|
| 1102 |
/**
|
| 1103 |
* Creates a fresh version of this layer that will not be shared.
|
| 1104 |
*
|
| 1105 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1106 |
* ```ts
|
| 1107 |
-
* import { Effect, Layer, Ref
|
| 1108 |
*
|
| 1109 |
* class Counter extends Context.Service<Counter, {
|
| 1110 |
-
* readonly
|
| 1111 |
-
* readonly increment: () => Effect.Effect<number>
|
| 1112 |
* }>()("Counter") {}
|
| 1113 |
*
|
| 1114 |
-
*
|
| 1115 |
-
*
|
| 1116 |
-
*
|
| 1117 |
-
*
|
| 1118 |
-
*
|
| 1119 |
-
*
|
| 1120 |
-
*
|
| 1121 |
-
*
|
| 1122 |
-
*
|
| 1123 |
-
*
|
| 1124 |
-
* }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1125 |
* }))
|
| 1126 |
*
|
| 1127 |
-
*
|
| 1128 |
-
*
|
| 1129 |
-
* const
|
| 1130 |
-
*
|
|
|
|
| 1131 |
*
|
| 1132 |
-
*
|
| 1133 |
-
*
|
| 1134 |
-
* }).pipe(
|
| 1135 |
-
* Effect.provide(counterLayer)
|
| 1136 |
-
* )
|
| 1137 |
*
|
| 1138 |
-
*
|
| 1139 |
-
*
|
| 1140 |
-
*
|
| 1141 |
-
*
|
|
|
|
| 1142 |
*
|
| 1143 |
-
*
|
| 1144 |
-
*
|
| 1145 |
-
*
|
| 1146 |
-
*
|
| 1147 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1148 |
* ```
|
| 1149 |
*
|
|
|
|
| 1150 |
* @since 2.0.0
|
| 1151 |
-
* @category utils
|
| 1152 |
*/
|
| 1153 |
export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMapUnsafe(), scope));
|
| 1154 |
/**
|
| 1155 |
-
* Builds this layer and
|
| 1156 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1157 |
*
|
| 1158 |
-
* @example
|
| 1159 |
* ```ts
|
| 1160 |
-
* import { Console, Effect, Layer
|
| 1161 |
*
|
| 1162 |
* class HttpServer extends Context.Service<HttpServer, {
|
| 1163 |
* readonly start: () => Effect.Effect<string>
|
|
@@ -1169,7 +1442,7 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
| 1169 |
* }>()("Logger") {}
|
| 1170 |
*
|
| 1171 |
* // Server layer that starts an HTTP server
|
| 1172 |
-
* const serverLayer = Layer.effect(HttpServer
|
| 1173 |
* yield* Console.log("Starting HTTP server...")
|
| 1174 |
*
|
| 1175 |
* return {
|
|
@@ -1184,7 +1457,7 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
| 1184 |
* }
|
| 1185 |
* }))
|
| 1186 |
*
|
| 1187 |
-
* const loggerLayer = Layer.succeed(Logger
|
| 1188 |
* log: Effect.fn("Logger.log")((msg: string) => Console.log(`[LOG] ${msg}`))
|
| 1189 |
* })
|
| 1190 |
*
|
|
@@ -1202,18 +1475,27 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
| 1202 |
* // Effect.runFork(application)
|
| 1203 |
* ```
|
| 1204 |
*
|
|
|
|
| 1205 |
* @since 2.0.0
|
| 1206 |
-
* @category conversions
|
| 1207 |
*/
|
| 1208 |
export const launch = self => internalEffect.scoped(internalEffect.andThen(build(self), internalEffect.never));
|
| 1209 |
/**
|
| 1210 |
* Creates a mock layer for testing purposes. You can provide a partial
|
| 1211 |
-
* implementation of the service
|
| 1212 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1213 |
*
|
| 1214 |
-
* @example
|
| 1215 |
* ```ts
|
| 1216 |
-
* import { Effect, Layer
|
| 1217 |
*
|
| 1218 |
* class UserService extends Context.Service<UserService, {
|
| 1219 |
* readonly config: { apiUrl: string }
|
|
@@ -1249,8 +1531,8 @@ export const launch = self => internalEffect.scoped(internalEffect.andThen(build
|
|
| 1249 |
* )
|
| 1250 |
* ```
|
| 1251 |
*
|
| 1252 |
-
* @
|
| 1253 |
-
* @
|
| 1254 |
*/
|
| 1255 |
export const mock = function () {
|
| 1256 |
if (arguments.length === 1) {
|
|
@@ -1301,12 +1583,15 @@ const ChannelTypeId = "~effect/Channel";
|
|
| 1301 |
// Type constraints
|
| 1302 |
// -----------------------------------------------------------------------------
|
| 1303 |
/**
|
| 1304 |
-
* Ensures that
|
|
|
|
|
|
|
| 1305 |
*
|
| 1306 |
* This function provides compile-time type checking to ensure that the success
|
| 1307 |
-
* value of
|
|
|
|
|
|
|
| 1308 |
*
|
| 1309 |
-
* @example
|
| 1310 |
* ```ts
|
| 1311 |
* import { Layer } from "effect"
|
| 1312 |
*
|
|
@@ -1322,20 +1607,23 @@ const ChannelTypeId = "~effect/Channel";
|
|
| 1322 |
* // This would cause a TypeScript compilation error:
|
| 1323 |
* // const invalidLayer = satisfiesNumber(StringLayer)
|
| 1324 |
* // ^^^^^^^^^^^
|
| 1325 |
-
* // Type '
|
| 1326 |
* ```
|
| 1327 |
*
|
|
|
|
| 1328 |
* @since 4.0.0
|
| 1329 |
-
* @category Type constraints
|
| 1330 |
*/
|
| 1331 |
export const satisfiesSuccessType = () => layer => layer;
|
| 1332 |
/**
|
| 1333 |
-
* Ensures that
|
|
|
|
|
|
|
| 1334 |
*
|
| 1335 |
* This function provides compile-time type checking to ensure that the error
|
| 1336 |
-
* type of
|
|
|
|
|
|
|
| 1337 |
*
|
| 1338 |
-
* @example
|
| 1339 |
* ```ts
|
| 1340 |
* import { Layer } from "effect"
|
| 1341 |
*
|
|
@@ -1355,24 +1643,27 @@ export const satisfiesSuccessType = () => layer => layer;
|
|
| 1355 |
* // Type 'string' is not assignable to type 'Error'
|
| 1356 |
* ```
|
| 1357 |
*
|
|
|
|
| 1358 |
* @since 4.0.0
|
| 1359 |
-
* @category Type constraints
|
| 1360 |
*/
|
| 1361 |
export const satisfiesErrorType = () => layer => layer;
|
| 1362 |
/**
|
| 1363 |
-
* Ensures that
|
|
|
|
|
|
|
| 1364 |
*
|
| 1365 |
* This function provides compile-time type checking to ensure that the
|
| 1366 |
-
* requirements
|
|
|
|
|
|
|
| 1367 |
*
|
| 1368 |
-
* @example
|
| 1369 |
* ```ts
|
| 1370 |
* import { Layer } from "effect"
|
| 1371 |
*
|
| 1372 |
* declare const FortyTwoLayer: Layer.Layer<never, never, 42>
|
| 1373 |
* declare const StringLayer: Layer.Layer<never, never, string>
|
| 1374 |
*
|
| 1375 |
-
* // Define a constraint that the
|
| 1376 |
* const satisfiesNumber = Layer.satisfiesServicesType<number>()
|
| 1377 |
*
|
| 1378 |
* // This works - Layer<never, never, 42> extends Layer<never, never, number>
|
|
@@ -1384,21 +1675,27 @@ export const satisfiesErrorType = () => layer => layer;
|
|
| 1384 |
* // Type 'string' is not assignable to type 'number'
|
| 1385 |
* ```
|
| 1386 |
*
|
|
|
|
| 1387 |
* @since 4.0.0
|
| 1388 |
-
* @category Type constraints
|
| 1389 |
*/
|
| 1390 |
export const satisfiesServicesType = () => layer => layer;
|
| 1391 |
/**
|
| 1392 |
* Constructs a new `Layer` which creates a span and registers it as the current
|
| 1393 |
* parent span.
|
| 1394 |
*
|
|
|
|
|
|
|
| 1395 |
* This allows you to create a traced scope for layer construction, making all
|
| 1396 |
* operations within the layer constructor part of the same trace span. The span
|
| 1397 |
-
* is automatically
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1398 |
*
|
| 1399 |
-
* @example
|
| 1400 |
* ```ts
|
| 1401 |
-
* import { Console, Effect, Layer
|
|
|
|
| 1402 |
*
|
| 1403 |
* class Database extends Context.Service<Database, {
|
| 1404 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -1430,24 +1727,26 @@ export const satisfiesServicesType = () => layer => layer;
|
|
| 1430 |
* })
|
| 1431 |
* ```
|
| 1432 |
*
|
| 1433 |
-
* @since 4.0.0
|
| 1434 |
* @category tracing
|
|
|
|
| 1435 |
*/
|
| 1436 |
export const span = (name, options) => {
|
| 1437 |
options = internalTracer.addSpanStackTrace(options);
|
| 1438 |
return effect(Tracer.ParentSpan, options?.onEnd ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options));
|
| 1439 |
};
|
| 1440 |
/**
|
| 1441 |
-
* Constructs a
|
| 1442 |
-
* current parent span.
|
| 1443 |
*
|
| 1444 |
-
*
|
| 1445 |
-
*
|
| 1446 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1447 |
*
|
| 1448 |
-
* @example
|
| 1449 |
* ```ts
|
| 1450 |
-
* import { Console, Effect, Layer,
|
| 1451 |
*
|
| 1452 |
* class Database extends Context.Service<Database, {
|
| 1453 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -1472,21 +1771,24 @@ export const span = (name, options) => {
|
|
| 1472 |
* }))))
|
| 1473 |
* ```
|
| 1474 |
*
|
| 1475 |
-
* @since 4.0.0
|
| 1476 |
* @category tracing
|
|
|
|
| 1477 |
*/
|
| 1478 |
export const parentSpan = span => succeedContext(Tracer.ParentSpan.context(span));
|
| 1479 |
/**
|
| 1480 |
-
* Wraps a Layer with a new tracing span, making all operations in the layer
|
| 1481 |
* constructor part of the named trace span.
|
| 1482 |
*
|
|
|
|
|
|
|
| 1483 |
* This creates a new span for the layer's construction and execution. The span
|
| 1484 |
* is automatically ended when the layer's scope is closed. This is useful for
|
| 1485 |
* tracking the lifecycle and performance of layer initialization.
|
| 1486 |
*
|
| 1487 |
-
*
|
|
|
|
| 1488 |
* ```ts
|
| 1489 |
-
* import { Effect, Layer
|
| 1490 |
*
|
| 1491 |
* class Database extends Context.Service<Database, {
|
| 1492 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -1527,12 +1829,11 @@ export const parentSpan = span => succeedContext(Tracer.ParentSpan.context(span)
|
|
| 1527 |
*
|
| 1528 |
* yield* logger.log("Application ready")
|
| 1529 |
* return yield* database.query("SELECT * FROM users")
|
| 1530 |
-
* }).pipe(Effect.provide(appLayer)
|
| 1531 |
-
* )
|
| 1532 |
* ```
|
| 1533 |
*
|
| 1534 |
-
* @since 4.0.0
|
| 1535 |
* @category tracing
|
|
|
|
| 1536 |
*/
|
| 1537 |
export const withSpan = function () {
|
| 1538 |
const dataFirst = typeof arguments[0] !== "string";
|
|
@@ -1545,15 +1846,23 @@ export const withSpan = function () {
|
|
| 1545 |
return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span)));
|
| 1546 |
};
|
| 1547 |
/**
|
| 1548 |
-
* Wraps a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1549 |
*
|
| 1550 |
-
*
|
| 1551 |
-
* the layer children of the provided parent span. This is useful for integrating
|
| 1552 |
-
* layer construction into an existing trace hierarchy.
|
| 1553 |
*
|
| 1554 |
-
* @example
|
| 1555 |
* ```ts
|
| 1556 |
-
* import { Effect, Layer,
|
| 1557 |
*
|
| 1558 |
* class Database extends Context.Service<Database, {
|
| 1559 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -1600,8 +1909,8 @@ export const withSpan = function () {
|
|
| 1600 |
* )
|
| 1601 |
* ```
|
| 1602 |
*
|
| 1603 |
-
* @since 4.0.0
|
| 1604 |
* @category tracing
|
|
|
|
| 1605 |
*/
|
| 1606 |
export const withParentSpan = function () {
|
| 1607 |
const dataFirst = isLayer(arguments[0]);
|
|
|
|
| 11 |
import * as Tracer from "./Tracer.js";
|
| 12 |
const TypeId = "~effect/Layer";
|
| 13 |
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
| 14 |
+
const memoMapReuse = (entry, scope) => {
|
| 15 |
+
entry.observers++;
|
| 16 |
+
return internalEffect.andThen(internalEffect.scopeAddFinalizerExit(scope, exit => entry.finalizer(exit)), entry.effect);
|
| 17 |
+
};
|
| 18 |
/**
|
| 19 |
* Returns `true` if the specified value is a `Layer`, `false` otherwise.
|
| 20 |
*
|
| 21 |
+
* **Example** (Checking whether a value is a layer)
|
| 22 |
+
*
|
| 23 |
* ```ts
|
| 24 |
+
* import { Context, Effect, Layer } from "effect"
|
| 25 |
*
|
| 26 |
* class Database extends Context.Service<Database, {
|
| 27 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 28 |
* }>()("Database") {}
|
| 29 |
*
|
| 30 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 31 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 32 |
* })
|
| 33 |
* const notALayer = { someProperty: "value" }
|
|
|
|
| 36 |
* console.log(Layer.isLayer(notALayer)) // false
|
| 37 |
* ```
|
| 38 |
*
|
|
|
|
| 39 |
* @category getters
|
| 40 |
+
* @since 2.0.0
|
| 41 |
*/
|
| 42 |
export const isLayer = u => hasProperty(u, TypeId);
|
| 43 |
const LayerProto = {
|
|
|
|
| 56 |
return self;
|
| 57 |
};
|
| 58 |
/**
|
| 59 |
+
* Constructs a `Layer` from a function that uses a `MemoMap` and `Scope` to
|
| 60 |
+
* build the layer.
|
| 61 |
+
*
|
| 62 |
+
* **Details**
|
| 63 |
*
|
| 64 |
* The function receives a `MemoMap` for memoization and a `Scope` for resource management.
|
| 65 |
* A child scope is created, and if the build fails, the child scope is closed.
|
| 66 |
*
|
| 67 |
+
* **Example** (Constructing a layer from a build function)
|
| 68 |
+
*
|
| 69 |
* ```ts
|
| 70 |
+
* import { Context, Effect, Layer } from "effect"
|
| 71 |
*
|
| 72 |
* class Database extends Context.Service<Database, {
|
| 73 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 82 |
* )
|
| 83 |
* ```
|
| 84 |
*
|
|
|
|
| 85 |
* @category constructors
|
| 86 |
+
* @since 4.0.0
|
| 87 |
*/
|
| 88 |
export const fromBuild = build => fromBuildUnsafe((memoMap, scope) => {
|
| 89 |
const layerScope = Scope.forkUnsafe(scope);
|
| 90 |
return internalEffect.onExit(build(memoMap, layerScope), exit => exit._tag === "Failure" ? Scope.close(layerScope, exit) : internalEffect.void);
|
| 91 |
});
|
| 92 |
/**
|
| 93 |
+
* Constructs a `Layer` from a function that uses a `MemoMap` and `Scope` to
|
| 94 |
+
* build the layer, with automatic memoization.
|
| 95 |
+
*
|
| 96 |
+
* **Details**
|
| 97 |
*
|
| 98 |
* This is similar to `fromBuild` but provides automatic memoization of the layer construction.
|
| 99 |
* The layer will be memoized based on the provided `MemoMap`.
|
| 100 |
*
|
| 101 |
+
* **Example** (Memoizing layer construction)
|
| 102 |
+
*
|
| 103 |
* ```ts
|
| 104 |
+
* import { Context, Effect, Layer } from "effect"
|
| 105 |
*
|
| 106 |
* class Database extends Context.Service<Database, {
|
| 107 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 116 |
* )
|
| 117 |
* ```
|
| 118 |
*
|
|
|
|
| 119 |
* @category constructors
|
| 120 |
+
* @since 4.0.0
|
| 121 |
*/
|
| 122 |
export const fromBuildMemo = build => {
|
| 123 |
const self = fromBuild((memoMap, scope) => memoMap.getOrElseMemoize(self, scope, build));
|
| 124 |
return self;
|
| 125 |
};
|
| 126 |
+
const memoMapBuild = (memoMap, layer, scope, build) => {
|
| 127 |
+
const layerScope = Scope.makeUnsafe();
|
| 128 |
+
const deferred = Deferred.makeUnsafe();
|
| 129 |
+
const entry = {
|
| 130 |
+
observers: 1,
|
| 131 |
+
effect: Deferred.await(deferred),
|
| 132 |
+
finalizer: exit => internalEffect.suspend(() => {
|
| 133 |
+
entry.observers--;
|
| 134 |
+
if (entry.observers === 0) {
|
| 135 |
+
memoMap.map.delete(layer);
|
| 136 |
+
return Scope.close(layerScope, exit);
|
| 137 |
+
}
|
| 138 |
+
return internalEffect.void;
|
| 139 |
+
})
|
| 140 |
+
};
|
| 141 |
+
memoMap.map.set(layer, entry);
|
| 142 |
+
return internalEffect.scopeAddFinalizerExit(scope, entry.finalizer).pipe(internalEffect.flatMap(() => build(memoMap, layerScope)), internalEffect.onExit(exit => {
|
| 143 |
+
entry.effect = exit;
|
| 144 |
+
return Deferred.done(deferred, exit);
|
| 145 |
+
}));
|
| 146 |
+
};
|
| 147 |
class MemoMapImpl {
|
| 148 |
get [MemoMapTypeId]() {
|
| 149 |
return MemoMapTypeId;
|
| 150 |
}
|
| 151 |
+
parent;
|
| 152 |
+
constructor(parent) {
|
| 153 |
+
this.parent = parent;
|
| 154 |
+
}
|
| 155 |
map = /*#__PURE__*/new Map();
|
| 156 |
+
get(layer, scope) {
|
| 157 |
+
const local = this.map.get(layer);
|
| 158 |
+
if (local) {
|
| 159 |
+
return memoMapReuse(local, scope);
|
| 160 |
+
}
|
| 161 |
+
return this.parent?.get(layer, scope);
|
| 162 |
+
}
|
| 163 |
getOrElseMemoize(layer, scope, build) {
|
| 164 |
+
const existing = this.get(layer, scope);
|
| 165 |
+
if (existing) {
|
| 166 |
+
return existing;
|
|
|
|
| 167 |
}
|
| 168 |
+
return memoMapBuild(this, layer, scope, build);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
}
|
| 170 |
}
|
| 171 |
/**
|
| 172 |
+
* Constructs a `MemoMap` synchronously so it can be used to build additional layers.
|
| 173 |
+
*
|
| 174 |
+
* **Example** (Creating a memo map unsafely)
|
| 175 |
*
|
|
|
|
| 176 |
* ```ts
|
| 177 |
+
* import { Context, Effect, Layer } from "effect"
|
| 178 |
*
|
| 179 |
* class Database extends Context.Service<Database, {
|
| 180 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 185 |
* const memoMap = Layer.makeMemoMapUnsafe()
|
| 186 |
* const scope = yield* Effect.scope
|
| 187 |
*
|
| 188 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 189 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 190 |
* })
|
| 191 |
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
|
|
| 194 |
* })
|
| 195 |
* ```
|
| 196 |
*
|
|
|
|
| 197 |
* @category memo map
|
| 198 |
+
* @since 4.0.0
|
| 199 |
*/
|
| 200 |
export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
| 201 |
/**
|
| 202 |
+
* Constructs a child `MemoMap` synchronously, allowing it to reuse layers
|
| 203 |
+
* already memoized in the parent while isolating any new layer allocations to
|
| 204 |
+
* the child map.
|
| 205 |
+
*
|
| 206 |
+
* **When to use**
|
| 207 |
+
*
|
| 208 |
+
* Use to synchronously fork a memo map for manual layer building when child
|
| 209 |
+
* builds should see parent memoized layers without writing newly built layers
|
| 210 |
+
* back to the parent.
|
| 211 |
+
*
|
| 212 |
+
* @see {@link forkMemoMap} for allocating the child memo map inside `Effect`
|
| 213 |
+
* @see {@link makeMemoMapUnsafe} for creating a root memo map without a parent
|
| 214 |
+
*
|
| 215 |
+
* @category memo map
|
| 216 |
+
* @since 4.0.0
|
| 217 |
+
*/
|
| 218 |
+
export const forkMemoMapUnsafe = parent => new MemoMapImpl(parent);
|
| 219 |
+
/**
|
| 220 |
+
* Constructs a `MemoMap` effectfully so it can be used to build additional layers.
|
| 221 |
+
*
|
| 222 |
+
* **Example** (Creating a memo map in an effect)
|
| 223 |
*
|
|
|
|
| 224 |
* ```ts
|
| 225 |
+
* import { Context, Effect, Layer } from "effect"
|
| 226 |
*
|
| 227 |
* class Database extends Context.Service<Database, {
|
| 228 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 233 |
* const memoMap = yield* Layer.makeMemoMap
|
| 234 |
* const scope = yield* Effect.scope
|
| 235 |
*
|
| 236 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 237 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 238 |
* })
|
| 239 |
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
|
|
| 242 |
* })
|
| 243 |
* ```
|
| 244 |
*
|
|
|
|
| 245 |
* @category memo map
|
| 246 |
+
* @since 2.0.0
|
| 247 |
*/
|
| 248 |
export const makeMemoMap = /*#__PURE__*/internalEffect.sync(makeMemoMapUnsafe);
|
| 249 |
/**
|
| 250 |
+
* Constructs a child `MemoMap` effectfully, allowing it to reuse layers already
|
| 251 |
+
* memoized in the parent while isolating any new layer allocations to the child
|
| 252 |
+
* map.
|
| 253 |
*
|
| 254 |
+
* **When to use**
|
| 255 |
+
*
|
| 256 |
+
* Use when a layer build should inherit already memoized layers from an
|
| 257 |
+
* existing `MemoMap` while keeping newly memoized layers out of the parent map.
|
| 258 |
+
*
|
| 259 |
+
* @see {@link makeMemoMap} for creating a root memo map in an `Effect`
|
| 260 |
+
* @see {@link forkMemoMapUnsafe} for the synchronous constructor variant
|
| 261 |
+
* @see {@link buildWithMemoMap} for building layers with an explicit memo map
|
| 262 |
+
*
|
| 263 |
+
* @category memo map
|
| 264 |
+
* @since 4.0.0
|
| 265 |
+
*/
|
| 266 |
+
export const forkMemoMap = parent => internalEffect.sync(() => forkMemoMapUnsafe(parent));
|
| 267 |
+
/**
|
| 268 |
+
* Context service for the current `MemoMap` used in layer construction.
|
| 269 |
+
*
|
| 270 |
+
* **When to use**
|
| 271 |
+
*
|
| 272 |
+
* Use when building custom layer operations that need to access the current
|
| 273 |
+
* memoization map from the fiber context.
|
| 274 |
+
*
|
| 275 |
+
* **Details**
|
| 276 |
+
*
|
| 277 |
+
* This service wraps a `MemoMap` as a `Context.Service`, making it available
|
| 278 |
+
* for dependency injection during layer construction.
|
| 279 |
+
*
|
| 280 |
+
* @see {@link MemoMap} the memoization map type wrapped by this service
|
| 281 |
*
|
|
|
|
| 282 |
* @category models
|
| 283 |
+
* @since 3.13.0
|
| 284 |
*/
|
| 285 |
export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer/CurrentMemoMap") {
|
| 286 |
static getOrCreate = /*#__PURE__*/Context.getOrElse(this, makeMemoMapUnsafe);
|
|
|
|
| 289 |
* Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
|
| 290 |
* the layer construction.
|
| 291 |
*
|
| 292 |
+
* **Example** (Building layers with an explicit memo map)
|
| 293 |
+
*
|
| 294 |
* ```ts
|
| 295 |
+
* import { Context, Effect, Layer } from "effect"
|
| 296 |
*
|
| 297 |
* class Database extends Context.Service<Database, {
|
| 298 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 308 |
* const scope = yield* Effect.scope
|
| 309 |
*
|
| 310 |
* // Build database layer with memoization
|
| 311 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 312 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 313 |
* })
|
| 314 |
* const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
| 315 |
*
|
| 316 |
* // Build logger layer with same memoization (reuses memo if same layer)
|
| 317 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 318 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 319 |
* })
|
| 320 |
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
|
|
| 330 |
* })
|
| 331 |
* ```
|
| 332 |
*
|
|
|
|
| 333 |
* @category memo map
|
| 334 |
+
* @since 2.0.0
|
| 335 |
*/
|
| 336 |
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope), Context.add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
|
| 337 |
/**
|
| 338 |
* Builds a layer into a scoped value.
|
| 339 |
*
|
| 340 |
+
* **Example** (Building a layer into a context)
|
| 341 |
+
*
|
| 342 |
* ```ts
|
| 343 |
+
* import { Context, Effect, Layer } from "effect"
|
| 344 |
*
|
| 345 |
* class Database extends Context.Service<Database, {
|
| 346 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 348 |
*
|
| 349 |
* // Build a layer to get its services
|
| 350 |
* const program = Effect.gen(function*() {
|
| 351 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 352 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 353 |
* })
|
| 354 |
*
|
|
|
|
| 362 |
* })
|
| 363 |
* ```
|
| 364 |
*
|
|
|
|
| 365 |
* @category destructors
|
| 366 |
+
* @since 2.0.0
|
| 367 |
*/
|
| 368 |
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), Context.getUnsafe(fiber.context, Scope.Scope)));
|
| 369 |
/**
|
| 370 |
+
* Builds a layer using an explicit scope.
|
| 371 |
+
*
|
| 372 |
+
* **When to use**
|
| 373 |
+
*
|
| 374 |
+
* Use to control the lifetime of layer resources with a scope supplied by the
|
| 375 |
+
* caller.
|
| 376 |
+
*
|
| 377 |
+
* **Details**
|
| 378 |
+
*
|
| 379 |
+
* Resources created by the layer are released when the supplied scope is
|
| 380 |
+
* closed, unless a resource extends its own scope.
|
| 381 |
+
*
|
| 382 |
+
* **Example** (Building a layer with an explicit scope)
|
| 383 |
*
|
|
|
|
| 384 |
* ```ts
|
| 385 |
+
* import { Context, Effect, Layer, Scope } from "effect"
|
| 386 |
*
|
| 387 |
* class Database extends Context.Service<Database, {
|
| 388 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 392 |
* const program = Effect.gen(function*() {
|
| 393 |
* const scope = yield* Effect.scope
|
| 394 |
*
|
| 395 |
+
* const dbLayer = Layer.effect(Database, Effect.gen(function*() {
|
| 396 |
* console.log("Initializing database...")
|
| 397 |
* yield* Scope.addFinalizer(
|
| 398 |
* scope,
|
|
|
|
| 410 |
* })
|
| 411 |
* ```
|
| 412 |
*
|
|
|
|
| 413 |
* @category destructors
|
| 414 |
+
* @since 2.0.0
|
| 415 |
*/
|
| 416 |
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), scope)));
|
| 417 |
/**
|
| 418 |
+
* Constructs a layer that provides a single service from an already available
|
| 419 |
+
* value.
|
| 420 |
+
*
|
| 421 |
+
* **When to use**
|
| 422 |
+
*
|
| 423 |
+
* Use when you need a `Layer` that provides a service from an already
|
| 424 |
+
* constructed implementation without effectful acquisition.
|
| 425 |
+
*
|
| 426 |
+
* **Example** (Creating a layer from a service implementation)
|
| 427 |
*
|
|
|
|
| 428 |
* ```ts
|
| 429 |
+
* import { Context, Effect, Layer } from "effect"
|
| 430 |
*
|
| 431 |
* class Database extends Context.Service<Database, {
|
| 432 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 433 |
* }>()("Database") {}
|
| 434 |
*
|
| 435 |
+
* const DatabaseLive = Layer.succeed(Database, {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
| 437 |
* })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
* ```
|
| 439 |
*
|
| 440 |
+
* @see {@link sync} for constructing layers from lazy values
|
| 441 |
+
*
|
| 442 |
* @category constructors
|
| 443 |
+
* @since 2.0.0
|
| 444 |
*/
|
| 445 |
export const succeed = function () {
|
| 446 |
if (arguments.length === 1) {
|
|
|
|
| 449 |
return succeedContext(Context.make(arguments[0], arguments[1]));
|
| 450 |
};
|
| 451 |
/**
|
| 452 |
+
* Constructs a layer that provides all services in an already available
|
| 453 |
+
* `Context`.
|
| 454 |
+
*
|
| 455 |
+
* **When to use**
|
| 456 |
*
|
| 457 |
+
* Use when you need a `Layer` built from an existing `Context`, including when
|
| 458 |
+
* you need to provide multiple services at once.
|
| 459 |
+
*
|
| 460 |
+
* **Details**
|
| 461 |
+
*
|
| 462 |
+
* This is a more general version of `succeed` that allows you to provide
|
| 463 |
+
* multiple services at once through a `Context`.
|
| 464 |
+
*
|
| 465 |
+
* **Example** (Providing multiple services from a context)
|
| 466 |
*
|
|
|
|
| 467 |
* ```ts
|
| 468 |
+
* import { Context, Effect, Layer } from "effect"
|
| 469 |
*
|
| 470 |
* class Database extends Context.Service<Database, {
|
| 471 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 486 |
* const layer = Layer.succeedContext(context)
|
| 487 |
* ```
|
| 488 |
*
|
| 489 |
+
* @see {@link succeed} for providing a single service from a value
|
| 490 |
+
*
|
| 491 |
* @category constructors
|
| 492 |
+
* @since 2.0.0
|
| 493 |
*/
|
| 494 |
export const succeedContext = context => fromBuildUnsafe(constant(internalEffect.succeed(context)));
|
| 495 |
/**
|
| 496 |
+
* An empty layer that provides no services, cannot fail, has no requirements,
|
| 497 |
+
* and performs no construction or finalization work.
|
| 498 |
+
*
|
| 499 |
+
* **When to use**
|
| 500 |
+
*
|
| 501 |
+
* Use as the no-op branch when conditionally composing layers.
|
| 502 |
*
|
| 503 |
+
* **Example** (Disabling optional lifecycle work)
|
|
|
|
| 504 |
*
|
|
|
|
| 505 |
* ```ts
|
| 506 |
+
* import { Console, Layer } from "effect"
|
| 507 |
+
*
|
| 508 |
+
* declare const flag: boolean
|
| 509 |
*
|
| 510 |
+
* const StartupLogLive = flag
|
| 511 |
+
* ? Layer.effectDiscard(Console.log("application starting"))
|
| 512 |
+
* : Layer.empty
|
| 513 |
* ```
|
| 514 |
*
|
| 515 |
+
* @see {@link effectDiscard} for running an effect while providing no services
|
| 516 |
+
*
|
| 517 |
* @category constructors
|
| 518 |
+
* @since 2.0.0
|
| 519 |
*/
|
| 520 |
export const empty = /*#__PURE__*/succeedContext(/*#__PURE__*/Context.empty());
|
| 521 |
/**
|
| 522 |
+
* Constructs a layer lazily that provides a single service.
|
| 523 |
+
*
|
| 524 |
+
* **When to use**
|
| 525 |
+
*
|
| 526 |
+
* Use when you need a `Layer` that provides one service whose value is created
|
| 527 |
+
* synchronously, but creation should be deferred until the layer is built.
|
| 528 |
+
*
|
| 529 |
+
* **Details**
|
| 530 |
*
|
| 531 |
* This is a lazy version of `succeed` where the service value is computed
|
| 532 |
* synchronously only when the layer is built.
|
| 533 |
*
|
| 534 |
+
* **Example** (Lazily providing a service)
|
| 535 |
+
*
|
| 536 |
* ```ts
|
| 537 |
+
* import { Context, Effect, Layer } from "effect"
|
| 538 |
*
|
| 539 |
* class Database extends Context.Service<Database, {
|
| 540 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 541 |
* }>()("Database") {}
|
| 542 |
*
|
| 543 |
+
* const layer = Layer.sync(Database, () => ({
|
| 544 |
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
| 545 |
* }))
|
| 546 |
* ```
|
| 547 |
*
|
| 548 |
+
* @see {@link succeed} for constructing layers from static values
|
| 549 |
+
*
|
| 550 |
* @category constructors
|
| 551 |
+
* @since 2.0.0
|
| 552 |
*/
|
| 553 |
export const sync = function () {
|
| 554 |
if (arguments.length === 1) {
|
|
|
|
| 557 |
return syncContext(() => Context.make(arguments[0], arguments[1]()));
|
| 558 |
};
|
| 559 |
/**
|
| 560 |
+
* Constructs a layer lazily that provides all services in a `Context`.
|
| 561 |
+
*
|
| 562 |
+
* **When to use**
|
| 563 |
+
*
|
| 564 |
+
* Use when you need a `Layer` that creates multiple services synchronously but
|
| 565 |
+
* defers that work until the layer is built.
|
| 566 |
+
*
|
| 567 |
+
* **Details**
|
| 568 |
*
|
| 569 |
+
* This is a lazy version of `succeedContext` where the `Context` is computed
|
| 570 |
* synchronously only when the layer is built.
|
| 571 |
*
|
| 572 |
+
* **Example** (Lazily providing a context)
|
| 573 |
+
*
|
| 574 |
* ```ts
|
| 575 |
+
* import { Context, Effect, Layer } from "effect"
|
| 576 |
*
|
| 577 |
* class Database extends Context.Service<Database, {
|
| 578 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 585 |
* )
|
| 586 |
* ```
|
| 587 |
*
|
| 588 |
+
* @see {@link sync} for lazily providing a single service
|
| 589 |
+
* @see {@link succeedContext} for providing an already available context
|
| 590 |
+
*
|
| 591 |
* @category constructors
|
| 592 |
+
* @since 2.0.0
|
| 593 |
*/
|
| 594 |
export const syncContext = evaluate => fromBuildMemo(constant(internalEffect.sync(evaluate)));
|
| 595 |
/**
|
| 596 |
+
* Constructs a layer from an effect that produces a single service.
|
| 597 |
*
|
| 598 |
+
* **When to use**
|
|
|
|
|
|
|
| 599 |
*
|
| 600 |
+
* Use when you need to construct a `Layer`-provided service with an `Effect`,
|
| 601 |
+
* dependencies, or scoped resource acquisition.
|
| 602 |
*
|
| 603 |
+
* **Details**
|
| 604 |
+
*
|
| 605 |
+
* This allows you to create a `Layer` from an `Effect` that produces a service.
|
| 606 |
+
* The `Effect` is executed in the scope of the layer, allowing for proper
|
| 607 |
+
* resource management.
|
| 608 |
*
|
| 609 |
+
* **Example** (Creating a layer from an effect)
|
| 610 |
*
|
|
|
|
| 611 |
* ```ts
|
| 612 |
+
* import { Context, Effect, Layer } from "effect"
|
| 613 |
*
|
| 614 |
* class Database extends Context.Service<Database, {
|
| 615 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 616 |
* }>()("Database") {}
|
| 617 |
*
|
| 618 |
+
* const layer = Layer.effect(Database,
|
| 619 |
* Effect.sync(() => ({
|
| 620 |
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
| 621 |
* }))
|
| 622 |
* )
|
| 623 |
* ```
|
| 624 |
*
|
| 625 |
+
* @see {@link effectContext} for effectfully providing multiple services
|
| 626 |
+
* @see {@link effectDiscard} for running construction work without providing services
|
| 627 |
+
*
|
| 628 |
* @category constructors
|
| 629 |
+
* @since 2.0.0
|
| 630 |
*/
|
| 631 |
export const effect = function () {
|
| 632 |
if (arguments.length === 1) {
|
|
|
|
| 636 |
};
|
| 637 |
const effectImpl = (service, effect) => effectContext(internalEffect.map(effect, value => Context.make(service, value)));
|
| 638 |
/**
|
| 639 |
+
* Constructs a layer from an effect that produces all services in a `Context`.
|
| 640 |
+
*
|
| 641 |
+
* **When to use**
|
| 642 |
+
*
|
| 643 |
+
* Use when you need a `Layer` that effectfully constructs a `Context` with
|
| 644 |
+
* multiple services.
|
| 645 |
+
*
|
| 646 |
+
* **Details**
|
| 647 |
+
*
|
| 648 |
+
* This allows you to create a `Layer` from an effectful computation that
|
| 649 |
+
* returns multiple services. The `Effect` is executed in the scope of the
|
| 650 |
+
* layer.
|
| 651 |
*
|
| 652 |
+
* **Example** (Creating a layer from an effectful context)
|
|
|
|
| 653 |
*
|
|
|
|
| 654 |
* ```ts
|
| 655 |
+
* import { Context, Effect, Layer } from "effect"
|
| 656 |
*
|
| 657 |
* class Database extends Context.Service<
|
| 658 |
* Database,
|
|
|
|
| 666 |
* )
|
| 667 |
* ```
|
| 668 |
*
|
| 669 |
+
* @see {@link effect} for effectfully providing a single service
|
| 670 |
+
*
|
| 671 |
* @category constructors
|
| 672 |
+
* @since 2.0.0
|
| 673 |
*/
|
| 674 |
export const effectContext = effect => fromBuildMemo((_, scope) => Scope.provide(effect, scope));
|
| 675 |
/**
|
| 676 |
+
* Constructs a layer from an effect, discarding its value and providing no
|
| 677 |
+
* services.
|
|
|
|
|
|
|
| 678 |
*
|
| 679 |
+
* **When to use**
|
| 680 |
*
|
| 681 |
+
* Use when layer construction should run an Effect for its side effects while providing no
|
| 682 |
+
* services.
|
| 683 |
*
|
| 684 |
+
* **Example** (Running an effect during layer construction)
|
| 685 |
*
|
|
|
|
| 686 |
* ```ts
|
| 687 |
* import { Effect, Layer } from "effect"
|
| 688 |
*
|
|
|
|
| 693 |
* )
|
| 694 |
* ```
|
| 695 |
*
|
| 696 |
+
* @see {@link empty} for a no-op layer that performs no construction work
|
| 697 |
+
*
|
| 698 |
* @category constructors
|
| 699 |
+
* @since 2.0.0
|
| 700 |
*/
|
| 701 |
export const effectDiscard = effect => effectContext(internalEffect.as(effect, Context.empty()));
|
| 702 |
/**
|
| 703 |
+
* Constructs a layer lazily using the specified factory.
|
| 704 |
+
*
|
| 705 |
+
* **Details**
|
| 706 |
*
|
| 707 |
* The factory is evaluated only when the suspended layer is first built, and
|
| 708 |
* the result is memoized with normal layer sharing semantics.
|
| 709 |
*
|
| 710 |
+
* **Example** (Choosing a layer lazily)
|
| 711 |
+
*
|
| 712 |
* ```ts
|
| 713 |
+
* import { Context, Layer } from "effect"
|
| 714 |
*
|
| 715 |
* class Config extends Context.Service<Config, string>()("Config") {}
|
| 716 |
*
|
|
|
|
| 718 |
*
|
| 719 |
* const layer = Layer.suspend(() =>
|
| 720 |
* useProd
|
| 721 |
+
* ? Layer.succeed(Config, "https://api.example.com")
|
| 722 |
+
* : Layer.succeed(Config, "http://localhost:3000")
|
| 723 |
* )
|
| 724 |
* ```
|
| 725 |
*
|
|
|
|
| 726 |
* @category constructors
|
| 727 |
+
* @since 2.0.0
|
| 728 |
*/
|
| 729 |
export const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)));
|
| 730 |
/**
|
| 731 |
+
* Unwraps a `Layer` from an `Effect`, flattening the nested structure.
|
| 732 |
+
*
|
| 733 |
+
* **When to use**
|
| 734 |
*
|
| 735 |
+
* Use when you have an `Effect` that produces a `Layer` and you want to
|
| 736 |
+
* use that layer directly.
|
| 737 |
+
*
|
| 738 |
+
* **Details**
|
| 739 |
+
*
|
| 740 |
+
* The resulting Layer will have the combined error and dependency types from
|
| 741 |
+
* both the outer Effect and the inner Layer.
|
| 742 |
+
*
|
| 743 |
+
* **Example** (Unwrapping an effectful layer)
|
| 744 |
*
|
|
|
|
| 745 |
* ```ts
|
| 746 |
+
* import { Context, Effect, Layer } from "effect"
|
| 747 |
*
|
| 748 |
* class Database extends Context.Service<Database, {
|
| 749 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 750 |
* }>()("Database") {}
|
| 751 |
*
|
| 752 |
* const layerEffect = Effect.succeed(
|
| 753 |
+
* Layer.succeed(Database, { query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result")) })
|
| 754 |
* )
|
| 755 |
*
|
| 756 |
* const unwrappedLayer = Layer.unwrap(layerEffect)
|
| 757 |
* ```
|
| 758 |
*
|
| 759 |
+
* @category converting
|
| 760 |
* @since 4.0.0
|
|
|
|
| 761 |
*/
|
| 762 |
export const unwrap = self => {
|
| 763 |
const service = Context.Service("effect/Layer/unwrap");
|
|
|
|
| 770 |
}).pipe(internalEffect.map(context => Context.mergeAll(...context)));
|
| 771 |
};
|
| 772 |
/**
|
| 773 |
+
* Combines all the provided layers concurrently, creating a new layer with
|
| 774 |
+
* merged input, error, and output types.
|
| 775 |
+
*
|
| 776 |
+
* **When to use**
|
| 777 |
+
*
|
| 778 |
+
* Use when you need to combine multiple independent layers.
|
| 779 |
+
*
|
| 780 |
+
* **Details**
|
| 781 |
*
|
| 782 |
* All layers are built concurrently, and their outputs are merged into a single layer.
|
|
|
|
| 783 |
*
|
| 784 |
+
* If multiple merged layers depend on the same layer value, that dependency is
|
| 785 |
+
* shared by default. Reuse a named layer value when you want services to share
|
| 786 |
+
* the same resource, such as one database pool.
|
| 787 |
+
*
|
| 788 |
+
* **Example** (Merging independent layers)
|
| 789 |
+
*
|
| 790 |
* ```ts
|
| 791 |
+
* import { Context, Effect, Layer } from "effect"
|
| 792 |
*
|
| 793 |
* class Database extends Context.Service<Database, {
|
| 794 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 798 |
* readonly log: (msg: string) => Effect.Effect<void>
|
| 799 |
* }>()("Logger") {}
|
| 800 |
*
|
| 801 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 802 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 803 |
* })
|
| 804 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 805 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 806 |
* })
|
| 807 |
*
|
| 808 |
* const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
|
| 809 |
* ```
|
| 810 |
*
|
| 811 |
+
* @see {@link merge} for merging one layer with another layer or array
|
| 812 |
+
*
|
| 813 |
* @category zipping
|
| 814 |
+
* @since 2.0.0
|
| 815 |
*/
|
| 816 |
export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEffect(layers, memoMap, scope));
|
| 817 |
/**
|
| 818 |
+
* Merges this layer with another layer concurrently, producing a new layer with
|
| 819 |
+
* combined input, error, and output types.
|
| 820 |
+
*
|
| 821 |
+
* **When to use**
|
| 822 |
*
|
| 823 |
+
* Use to combine an existing `Layer` with another `Layer` or an array of
|
| 824 |
+
* layers while preserving pipeline style.
|
| 825 |
+
*
|
| 826 |
+
* **Details**
|
| 827 |
+
*
|
| 828 |
+
* This is a binary version of `mergeAll` that merges exactly two layers or one
|
| 829 |
+
* layer with an array of layers. The layers are built concurrently and their
|
| 830 |
+
* outputs are combined.
|
| 831 |
+
*
|
| 832 |
+
* **Example** (Merging two layers)
|
| 833 |
*
|
|
|
|
| 834 |
* ```ts
|
| 835 |
+
* import { Context, Effect, Layer } from "effect"
|
| 836 |
*
|
| 837 |
* class Database extends Context.Service<Database, {
|
| 838 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 842 |
* readonly log: (msg: string) => Effect.Effect<void>
|
| 843 |
* }>()("Logger") {}
|
| 844 |
*
|
| 845 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 846 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
| 847 |
* })
|
| 848 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 849 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
| 850 |
* })
|
| 851 |
*
|
| 852 |
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
| 853 |
* ```
|
| 854 |
*
|
| 855 |
+
* @see {@link mergeAll} for merging several layers at once
|
| 856 |
+
*
|
| 857 |
* @category zipping
|
| 858 |
+
* @since 2.0.0
|
| 859 |
*/
|
| 860 |
export const merge = /*#__PURE__*/dual(2, (self, that) => mergeAll(self, ...(Array.isArray(that) ? that : [that])));
|
| 861 |
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.provideContext(context), internalEffect.map(merged => f(merged, context)))));
|
| 862 |
/**
|
| 863 |
+
* Feeds the output services of the dependency layer into the requirements of
|
| 864 |
+
* this layer, returning a layer that only provides the services from this layer.
|
| 865 |
+
*
|
| 866 |
+
* **When to use**
|
| 867 |
+
*
|
| 868 |
+
* Use when you need to hide an implementation dependency layer from callers.
|
| 869 |
+
*
|
| 870 |
+
* **Details**
|
| 871 |
+
*
|
| 872 |
+
* In `serviceLayer.pipe(Layer.provide(dependencyLayer))`, the dependency layer is
|
| 873 |
+
* built first and is used to satisfy the requirements of `serviceLayer`.
|
| 874 |
+
*
|
| 875 |
+
* **Example** (Providing layer dependencies)
|
| 876 |
*
|
|
|
|
| 877 |
* ```ts
|
| 878 |
+
* import { Context, Effect, Layer } from "effect"
|
| 879 |
*
|
| 880 |
* class Database extends Context.Service<Database, {
|
| 881 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 893 |
* }>()("Logger") {}
|
| 894 |
*
|
| 895 |
* // Create dependency layers
|
| 896 |
+
* const databaseLayer = Layer.succeed(Database, {
|
| 897 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
| 898 |
* })
|
| 899 |
*
|
| 900 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 901 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
| 902 |
* })
|
| 903 |
*
|
| 904 |
* // UserService depends on Database and Logger
|
| 905 |
+
* const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
|
| 906 |
* const database = yield* Database
|
| 907 |
* const logger = yield* Logger
|
| 908 |
*
|
|
|
|
| 931 |
* )
|
| 932 |
* ```
|
| 933 |
*
|
| 934 |
+
* @see {@link provideMerge} for retaining the dependency services
|
| 935 |
+
*
|
| 936 |
+
* @category providing services
|
| 937 |
* @since 2.0.0
|
|
|
|
| 938 |
*/
|
| 939 |
export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, identity));
|
| 940 |
/**
|
| 941 |
+
* Feeds the output services of the dependency layer into the requirements of
|
| 942 |
+
* this layer, returning a layer that provides both sets of services.
|
| 943 |
+
*
|
| 944 |
+
* **When to use**
|
| 945 |
+
*
|
| 946 |
+
* Use when you need to compose `Layer`s while keeping both the constructed
|
| 947 |
+
* service and the dependency used to build it available.
|
| 948 |
+
*
|
| 949 |
+
* **Details**
|
| 950 |
+
*
|
| 951 |
+
* Prefer {@link provide} when the dependency should stay private.
|
| 952 |
+
*
|
| 953 |
+
* **Example** (Providing dependencies while retaining services)
|
| 954 |
*
|
|
|
|
| 955 |
* ```ts
|
| 956 |
+
* import { Context, Effect, Layer } from "effect"
|
| 957 |
*
|
| 958 |
* class Database extends Context.Service<Database, {
|
| 959 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 971 |
* }>()("UserService") {}
|
| 972 |
*
|
| 973 |
* // Create dependency layers
|
| 974 |
+
* const databaseLayer = Layer.succeed(Database, {
|
| 975 |
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
| 976 |
* })
|
| 977 |
*
|
| 978 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 979 |
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
| 980 |
* })
|
| 981 |
*
|
| 982 |
* // UserService depends on Database and Logger
|
| 983 |
+
* const userServiceLayer = Layer.effect(UserService, Effect.gen(function*() {
|
| 984 |
* const database = yield* Database
|
| 985 |
* const logger = yield* Logger
|
| 986 |
*
|
|
|
|
| 1015 |
* )
|
| 1016 |
* ```
|
| 1017 |
*
|
| 1018 |
+
* @see {@link provide} for keeping dependency services private
|
| 1019 |
+
*
|
| 1020 |
+
* @category providing services
|
| 1021 |
* @since 2.0.0
|
|
|
|
| 1022 |
*/
|
| 1023 |
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) => Context.merge(that, self)));
|
| 1024 |
/**
|
| 1025 |
* Constructs a layer dynamically based on the output of this layer.
|
| 1026 |
*
|
| 1027 |
+
* **Example** (Creating services from layer output)
|
| 1028 |
+
*
|
| 1029 |
* ```ts
|
| 1030 |
+
* import { Context, Effect, Layer } from "effect"
|
| 1031 |
*
|
| 1032 |
* class Config extends Context.Service<Config, {
|
| 1033 |
* readonly dbUrl: string
|
|
|
|
| 1043 |
* }>()("Logger") {}
|
| 1044 |
*
|
| 1045 |
* // Base config layer
|
| 1046 |
+
* const configLayer = Layer.succeed(Config, {
|
| 1047 |
* dbUrl: "postgres://localhost:5432/mydb",
|
| 1048 |
* logLevel: "debug"
|
| 1049 |
* })
|
|
|
|
| 1054 |
* const config = Context.get(context, Config)
|
| 1055 |
*
|
| 1056 |
* // Create database layer based on config
|
| 1057 |
+
* const dbLayer = Layer.succeed(Database, {
|
| 1058 |
* query: Effect.fn("Database.query")((sql: string) =>
|
| 1059 |
* Effect.succeed(
|
| 1060 |
* `Querying ${config.dbUrl}: ${sql}`
|
|
|
|
| 1062 |
* })
|
| 1063 |
*
|
| 1064 |
* // Create logger layer based on config
|
| 1065 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 1066 |
* log: Effect.fn("Logger.log")((msg: string) =>
|
| 1067 |
* config.logLevel === "debug"
|
| 1068 |
* ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
|
|
|
|
| 1089 |
* )
|
| 1090 |
* ```
|
| 1091 |
*
|
|
|
|
| 1092 |
* @category sequencing
|
| 1093 |
+
* @since 2.0.0
|
| 1094 |
*/
|
| 1095 |
export const flatMap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => f(context).build(memoMap, scope))));
|
| 1096 |
/**
|
| 1097 |
* Performs the specified effect if this layer succeeds.
|
| 1098 |
*
|
| 1099 |
+
* **When to use**
|
| 1100 |
+
*
|
| 1101 |
+
* Use to run an effectful observation after a layer has been built
|
| 1102 |
+
* successfully, such as logging or metrics, without changing the services the
|
| 1103 |
+
* layer provides.
|
| 1104 |
+
*
|
| 1105 |
+
* **Details**
|
| 1106 |
+
*
|
| 1107 |
+
* The callback receives the services produced by this layer. Its result is
|
| 1108 |
+
* discarded, and the original layer output is preserved.
|
| 1109 |
+
*
|
| 1110 |
+
* @see {@link tapError} for running an effect when layer construction fails with a typed error
|
| 1111 |
+
* @see {@link tapCause} for running an effect when layer construction fails with any cause
|
| 1112 |
+
*
|
| 1113 |
* @category sequencing
|
| 1114 |
+
* @since 2.0.0
|
| 1115 |
*/
|
| 1116 |
export const tap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => Scope.provide(internalEffect.as(f(context), context), scope))));
|
| 1117 |
/**
|
| 1118 |
* Performs the specified effect if this layer fails.
|
| 1119 |
*
|
| 1120 |
+
* **When to use**
|
| 1121 |
+
*
|
| 1122 |
+
* Use to run logging, metrics, or other effects when layer construction fails
|
| 1123 |
+
* while preserving the original typed error.
|
| 1124 |
+
*
|
| 1125 |
+
* **Details**
|
| 1126 |
+
*
|
| 1127 |
+
* The callback receives the typed error. If the callback succeeds, the layer
|
| 1128 |
+
* still fails with the original error; if the callback fails, that failure is
|
| 1129 |
+
* added to the layer's error type.
|
| 1130 |
+
*
|
| 1131 |
+
* @see {@link tap} for running an effect when layer construction succeeds
|
| 1132 |
+
* @see {@link tapCause} for inspecting the full failure cause, including defects and interruption
|
| 1133 |
+
*
|
| 1134 |
* @category sequencing
|
| 1135 |
+
* @since 2.0.0
|
| 1136 |
*/
|
| 1137 |
export const tapError = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catch_(self.build(memoMap, scope), error => Scope.provide(internalEffect.andThen(f(error), internalEffect.fail(error)), scope))));
|
| 1138 |
/**
|
| 1139 |
+
* Performs the specified effect when this layer fails with any cause.
|
| 1140 |
*
|
| 1141 |
+
* **When to use**
|
| 1142 |
*
|
| 1143 |
+
* Use to run diagnostics or reporting when layer construction fails and the
|
| 1144 |
+
* full `Cause` is needed.
|
| 1145 |
*
|
| 1146 |
+
* **Details**
|
| 1147 |
+
*
|
| 1148 |
+
* The callback receives the layer's `Cause`, so it can inspect typed errors,
|
| 1149 |
+
* defects, and interruption information. If the callback succeeds, the layer
|
| 1150 |
+
* fails again with the original cause; if the callback fails, that failure is
|
| 1151 |
+
* added to the layer's error type.
|
| 1152 |
+
*
|
| 1153 |
+
* @see {@link tapError} for observing only typed layer construction errors
|
| 1154 |
+
* @see {@link catchCause} for recovering from a layer construction failure by switching to another layer
|
| 1155 |
*
|
|
|
|
| 1156 |
* @category sequencing
|
| 1157 |
+
* @since 4.0.0
|
| 1158 |
*/
|
| 1159 |
export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catchCause(self.build(memoMap, scope), cause => Scope.provide(internalEffect.andThen(f(cause), internalEffect.failCause(cause)), scope))));
|
| 1160 |
/**
|
| 1161 |
+
* Converts layer construction failures into defects, removing them from the
|
| 1162 |
+
* layer's error type.
|
| 1163 |
+
*
|
| 1164 |
+
* **Details**
|
| 1165 |
+
*
|
| 1166 |
+
* Use this only when failures should be treated as unrecoverable defects rather
|
| 1167 |
+
* than typed errors that callers can handle.
|
| 1168 |
+
*
|
| 1169 |
+
* **Example** (Converting layer failures to defects)
|
| 1170 |
*
|
|
|
|
| 1171 |
* ```ts
|
| 1172 |
+
* import { Context, Data, Effect, Layer } from "effect"
|
| 1173 |
*
|
| 1174 |
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
| 1175 |
* message: string
|
|
|
|
| 1180 |
* }>()("Database") {}
|
| 1181 |
*
|
| 1182 |
* // Layer that can fail during construction
|
| 1183 |
+
* const flakyDatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
| 1184 |
+
* console.log("connecting")
|
| 1185 |
+
* return yield* new DatabaseError({ message: "Connection failed" })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1186 |
* }))
|
| 1187 |
*
|
| 1188 |
* // Convert failures to fiber death - removes error from type
|
|
|
|
| 1196 |
* Effect.provide(reliableDatabaseLayer)
|
| 1197 |
* )
|
| 1198 |
*
|
| 1199 |
+
* // Running the program prints "connecting", then the DatabaseError is
|
| 1200 |
+
* // converted into a fiber defect instead of remaining a typed error.
|
| 1201 |
* ```
|
| 1202 |
*
|
|
|
|
| 1203 |
* @category error handling
|
| 1204 |
+
* @since 2.0.0
|
| 1205 |
*/
|
| 1206 |
export const orDie = self => fromBuildUnsafe((memoMap, scope) => internalEffect.orDie(self.build(memoMap, scope)));
|
| 1207 |
const catch_ = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => internalEffect.catch_(self.build(memoMap, scope), e => onError(e).build(memoMap, scope))));
|
| 1208 |
export {
|
| 1209 |
/**
|
| 1210 |
+
* Recovers from all typed errors by switching to another layer.
|
| 1211 |
+
*
|
| 1212 |
+
* **When to use**
|
| 1213 |
+
*
|
| 1214 |
+
* Use when every typed `Layer` construction error should use the same
|
| 1215 |
+
* recovery path.
|
| 1216 |
+
*
|
| 1217 |
+
* @see {@link catchTag} for recovering from specific tagged errors
|
| 1218 |
+
* @see {@link catchCause} for recovering with access to the full cause
|
| 1219 |
*
|
|
|
|
| 1220 |
* @category error handling
|
| 1221 |
+
* @since 4.0.0
|
| 1222 |
*/
|
| 1223 |
catch_ as catch };
|
| 1224 |
/**
|
| 1225 |
* Recovers from specific tagged errors.
|
| 1226 |
*
|
| 1227 |
+
* **When to use**
|
| 1228 |
+
*
|
| 1229 |
+
* Use when only some tagged `Layer` construction errors should be recovered.
|
| 1230 |
+
*
|
| 1231 |
+
* **Example** (Recovering from tagged layer errors)
|
| 1232 |
+
*
|
| 1233 |
* ```ts
|
| 1234 |
+
* import { Context, Data, Effect, Layer } from "effect"
|
| 1235 |
*
|
| 1236 |
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
| 1237 |
*
|
|
|
|
| 1239 |
* readonly apiUrl: string
|
| 1240 |
* }>()("Config") {}
|
| 1241 |
*
|
| 1242 |
+
* const configLayer = Layer.effect(Config, Effect.fail(new ConfigError()))
|
| 1243 |
*
|
| 1244 |
+
* const fallbackLayer = Layer.succeed(Config, { apiUrl: "http://localhost" })
|
| 1245 |
*
|
| 1246 |
* const recovered = configLayer.pipe(
|
| 1247 |
* Layer.catchTag("ConfigError", () => fallbackLayer)
|
| 1248 |
* )
|
| 1249 |
* ```
|
| 1250 |
*
|
| 1251 |
+
* @see {@link catchCause} for recovering with access to the full cause
|
| 1252 |
+
*
|
| 1253 |
* @category error handling
|
| 1254 |
+
* @since 4.0.0
|
| 1255 |
*/
|
| 1256 |
export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((memoMap, scope) => internalEffect.catchTag(self.build(memoMap, scope), k, error => f(error).build(memoMap, scope))));
|
| 1257 |
/**
|
| 1258 |
+
* Recovers from any failure cause by switching to another layer.
|
| 1259 |
+
*
|
| 1260 |
+
* **When to use**
|
| 1261 |
+
*
|
| 1262 |
+
* Use when you need `Layer` recovery to inspect more than the typed error,
|
| 1263 |
+
* such as defects or interruption information.
|
| 1264 |
+
*
|
| 1265 |
+
* **Details**
|
| 1266 |
+
*
|
| 1267 |
+
* The handler receives the full `Cause` of the failed layer, including typed
|
| 1268 |
+
* errors, unexpected defects, and interruption information, and returns the
|
| 1269 |
+
* fallback layer to build instead. Finalizers for resources acquired by the
|
| 1270 |
+
* failed layer are still run before the fallback layer is acquired.
|
| 1271 |
+
*
|
| 1272 |
+
* **Example** (Recovering from layer failures by cause)
|
| 1273 |
*
|
|
|
|
| 1274 |
* ```ts
|
| 1275 |
+
* import { Context, Data, Effect, Layer } from "effect"
|
| 1276 |
*
|
| 1277 |
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
| 1278 |
* message: string
|
| 1279 |
* }> {}
|
| 1280 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1281 |
* class Database extends Context.Service<Database, {
|
| 1282 |
* readonly query: (sql: string) => Effect.Effect<string>
|
| 1283 |
* }>()("Database") {}
|
| 1284 |
*
|
| 1285 |
+
* const primaryDatabaseLayer = Layer.effect(Database,
|
| 1286 |
+
* Effect.fail(new DatabaseError({ message: "Primary DB unreachable" }))
|
| 1287 |
+
* )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1288 |
*
|
|
|
|
| 1289 |
* const databaseWithFallback = primaryDatabaseLayer.pipe(
|
| 1290 |
* Layer.catchCause(() => {
|
| 1291 |
+
* return Layer.succeed(Database, {
|
| 1292 |
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
|
| 1293 |
+
* })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1294 |
* })
|
| 1295 |
* )
|
| 1296 |
*
|
| 1297 |
* const program = Effect.gen(function*() {
|
| 1298 |
* const database = yield* Database
|
| 1299 |
+
* const result = yield* database.query("SELECT * FROM users")
|
| 1300 |
+
* console.log(result)
|
| 1301 |
* }).pipe(
|
| 1302 |
* Effect.provide(databaseWithFallback)
|
| 1303 |
* )
|
| 1304 |
+
*
|
| 1305 |
+
* Effect.runPromise(program)
|
| 1306 |
+
* // Memory: SELECT * FROM users
|
| 1307 |
* ```
|
| 1308 |
*
|
| 1309 |
+
* @see {@link catchTag} for recovering from specific tagged errors
|
| 1310 |
+
*
|
| 1311 |
* @category error handling
|
| 1312 |
+
* @since 4.0.0
|
| 1313 |
*/
|
| 1314 |
export const catchCause = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsafe((memoMap, scope) => internalEffect.catchCause(self.build(memoMap, scope), cause => onError(cause).build(memoMap, scope))));
|
| 1315 |
/**
|
| 1316 |
* Updates a service in the context with a new implementation.
|
| 1317 |
*
|
| 1318 |
+
* **When to use**
|
| 1319 |
+
*
|
| 1320 |
+
* Use to adapt or extend a service's behavior during the creation of a
|
| 1321 |
+
* layer.
|
| 1322 |
+
*
|
| 1323 |
* **Details**
|
| 1324 |
*
|
| 1325 |
* This function modifies the existing implementation of a service in the
|
|
|
|
| 1327 |
* transformation function `f`, and replaces the old service with the
|
| 1328 |
* transformed one.
|
| 1329 |
*
|
| 1330 |
+
* @category providing services
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1331 |
* @since 3.13.0
|
|
|
|
| 1332 |
*/
|
| 1333 |
+
export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide(layer, effect(service, internalEffect.map(service, f))));
|
| 1334 |
/**
|
| 1335 |
* Creates a fresh version of this layer that will not be shared.
|
| 1336 |
*
|
| 1337 |
+
* **When to use**
|
| 1338 |
+
*
|
| 1339 |
+
* Use when you need two parts of an application to receive separate instances
|
| 1340 |
+
* of a resource, such as two independent client sessions.
|
| 1341 |
+
*
|
| 1342 |
+
* **Gotchas**
|
| 1343 |
+
*
|
| 1344 |
+
* Do not use it just to work around confusing composition. By default, sharing
|
| 1345 |
+
* the same layer value is usually the desired behavior.
|
| 1346 |
+
*
|
| 1347 |
+
* **Example** (Creating non-shared layer instances)
|
| 1348 |
+
*
|
| 1349 |
* ```ts
|
| 1350 |
+
* import { Context, Effect, Layer, Ref } from "effect"
|
| 1351 |
*
|
| 1352 |
* class Counter extends Context.Service<Counter, {
|
| 1353 |
+
* readonly id: number
|
|
|
|
| 1354 |
* }>()("Counter") {}
|
| 1355 |
*
|
| 1356 |
+
* class Left extends Context.Service<Left, {
|
| 1357 |
+
* readonly counterId: number
|
| 1358 |
+
* }>()("Left") {}
|
| 1359 |
+
*
|
| 1360 |
+
* class Right extends Context.Service<Right, {
|
| 1361 |
+
* readonly counterId: number
|
| 1362 |
+
* }>()("Right") {}
|
| 1363 |
+
*
|
| 1364 |
+
* const leftLayer = Layer.effect(Left, Effect.gen(function*() {
|
| 1365 |
+
* const counter = yield* Counter
|
| 1366 |
+
* return { counterId: counter.id }
|
| 1367 |
+
* }))
|
| 1368 |
+
*
|
| 1369 |
+
* const rightLayer = Layer.effect(Right, Effect.gen(function*() {
|
| 1370 |
+
* const counter = yield* Counter
|
| 1371 |
+
* return { counterId: counter.id }
|
| 1372 |
* }))
|
| 1373 |
*
|
| 1374 |
+
* const showIds = Effect.gen(function*() {
|
| 1375 |
+
* const left = yield* Left
|
| 1376 |
+
* const right = yield* Right
|
| 1377 |
+
* console.log(`same Counter: ${left.counterId === right.counterId}`)
|
| 1378 |
+
* })
|
| 1379 |
*
|
| 1380 |
+
* const program = Effect.gen(function*() {
|
| 1381 |
+
* const nextId = yield* Ref.make(0)
|
|
|
|
|
|
|
|
|
|
| 1382 |
*
|
| 1383 |
+
* const counterLayer = Layer.effect(Counter, Effect.gen(function*() {
|
| 1384 |
+
* const id = yield* Ref.updateAndGet(nextId, (n) => n + 1)
|
| 1385 |
+
* console.log("constructed Counter")
|
| 1386 |
+
* return { id }
|
| 1387 |
+
* }))
|
| 1388 |
*
|
| 1389 |
+
* const shared = Layer.merge(
|
| 1390 |
+
* Layer.provide(leftLayer, counterLayer),
|
| 1391 |
+
* Layer.provide(rightLayer, counterLayer)
|
| 1392 |
+
* )
|
| 1393 |
+
*
|
| 1394 |
+
* yield* Effect.provide(showIds, shared)
|
| 1395 |
+
*
|
| 1396 |
+
* const freshCounterLayer = Layer.fresh(counterLayer)
|
| 1397 |
+
* const fresh = Layer.merge(
|
| 1398 |
+
* Layer.provide(leftLayer, freshCounterLayer),
|
| 1399 |
+
* Layer.provide(rightLayer, freshCounterLayer)
|
| 1400 |
+
* )
|
| 1401 |
+
*
|
| 1402 |
+
* yield* Effect.provide(showIds, fresh)
|
| 1403 |
+
* })
|
| 1404 |
+
*
|
| 1405 |
+
* Effect.runPromise(program)
|
| 1406 |
+
* // constructed Counter
|
| 1407 |
+
* // same Counter: true
|
| 1408 |
+
* // constructed Counter
|
| 1409 |
+
* // constructed Counter
|
| 1410 |
+
* // same Counter: false
|
| 1411 |
* ```
|
| 1412 |
*
|
| 1413 |
+
* @category layers
|
| 1414 |
* @since 2.0.0
|
|
|
|
| 1415 |
*/
|
| 1416 |
export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMapUnsafe(), scope));
|
| 1417 |
/**
|
| 1418 |
+
* Builds this layer and keeps it alive until the returned effect is interrupted.
|
| 1419 |
+
*
|
| 1420 |
+
* **When to use**
|
| 1421 |
+
*
|
| 1422 |
+
* Use when you model your entire application as a layer, such as an HTTP
|
| 1423 |
+
* server.
|
| 1424 |
+
*
|
| 1425 |
+
* **Details**
|
| 1426 |
+
*
|
| 1427 |
+
* When the returned effect is interrupted, the layer scope is closed and all
|
| 1428 |
+
* finalizers registered during layer acquisition are run.
|
| 1429 |
+
*
|
| 1430 |
+
* **Example** (Launching an application layer)
|
| 1431 |
*
|
|
|
|
| 1432 |
* ```ts
|
| 1433 |
+
* import { Console, Context, Effect, Layer } from "effect"
|
| 1434 |
*
|
| 1435 |
* class HttpServer extends Context.Service<HttpServer, {
|
| 1436 |
* readonly start: () => Effect.Effect<string>
|
|
|
|
| 1442 |
* }>()("Logger") {}
|
| 1443 |
*
|
| 1444 |
* // Server layer that starts an HTTP server
|
| 1445 |
+
* const serverLayer = Layer.effect(HttpServer, Effect.gen(function*() {
|
| 1446 |
* yield* Console.log("Starting HTTP server...")
|
| 1447 |
*
|
| 1448 |
* return {
|
|
|
|
| 1457 |
* }
|
| 1458 |
* }))
|
| 1459 |
*
|
| 1460 |
+
* const loggerLayer = Layer.succeed(Logger, {
|
| 1461 |
* log: Effect.fn("Logger.log")((msg: string) => Console.log(`[LOG] ${msg}`))
|
| 1462 |
* })
|
| 1463 |
*
|
|
|
|
| 1475 |
* // Effect.runFork(application)
|
| 1476 |
* ```
|
| 1477 |
*
|
| 1478 |
+
* @category converting
|
| 1479 |
* @since 2.0.0
|
|
|
|
| 1480 |
*/
|
| 1481 |
export const launch = self => internalEffect.scoped(internalEffect.andThen(build(self), internalEffect.never));
|
| 1482 |
/**
|
| 1483 |
* Creates a mock layer for testing purposes. You can provide a partial
|
| 1484 |
+
* implementation of the service. Any missing members that are `Effect`s,
|
| 1485 |
+
* `Stream`s, `Channel`s, or functions returning them will fail with an
|
| 1486 |
+
* unimplemented defect when used.
|
| 1487 |
+
*
|
| 1488 |
+
* **Details**
|
| 1489 |
+
*
|
| 1490 |
+
* Missing members are represented by a value that can be used as an `Effect`,
|
| 1491 |
+
* `Stream`, `Channel`, or as a function returning an `Effect`. This lets the
|
| 1492 |
+
* mock preserve the shape of common service methods while still failing loudly
|
| 1493 |
+
* when an unimplemented member is exercised.
|
| 1494 |
+
*
|
| 1495 |
+
* **Example** (Mocking services for tests)
|
| 1496 |
*
|
|
|
|
| 1497 |
* ```ts
|
| 1498 |
+
* import { Context, Effect, Layer } from "effect"
|
| 1499 |
*
|
| 1500 |
* class UserService extends Context.Service<UserService, {
|
| 1501 |
* readonly config: { apiUrl: string }
|
|
|
|
| 1531 |
* )
|
| 1532 |
* ```
|
| 1533 |
*
|
| 1534 |
+
* @category testing
|
| 1535 |
+
* @since 3.17.0
|
| 1536 |
*/
|
| 1537 |
export const mock = function () {
|
| 1538 |
if (arguments.length === 1) {
|
|
|
|
| 1583 |
// Type constraints
|
| 1584 |
// -----------------------------------------------------------------------------
|
| 1585 |
/**
|
| 1586 |
+
* Ensures that a layer's success type extends a given type `ROut`.
|
| 1587 |
+
*
|
| 1588 |
+
* **Details**
|
| 1589 |
*
|
| 1590 |
* This function provides compile-time type checking to ensure that the success
|
| 1591 |
+
* value of a layer conforms to a specific type constraint.
|
| 1592 |
+
*
|
| 1593 |
+
* **Example** (Constraining layer success types)
|
| 1594 |
*
|
|
|
|
| 1595 |
* ```ts
|
| 1596 |
* import { Layer } from "effect"
|
| 1597 |
*
|
|
|
|
| 1607 |
* // This would cause a TypeScript compilation error:
|
| 1608 |
* // const invalidLayer = satisfiesNumber(StringLayer)
|
| 1609 |
* // ^^^^^^^^^^^
|
| 1610 |
+
* // Type 'string' is not assignable to type 'number'
|
| 1611 |
* ```
|
| 1612 |
*
|
| 1613 |
+
* @category utility types
|
| 1614 |
* @since 4.0.0
|
|
|
|
| 1615 |
*/
|
| 1616 |
export const satisfiesSuccessType = () => layer => layer;
|
| 1617 |
/**
|
| 1618 |
+
* Ensures that a layer's error type extends a given type `E`.
|
| 1619 |
+
*
|
| 1620 |
+
* **Details**
|
| 1621 |
*
|
| 1622 |
* This function provides compile-time type checking to ensure that the error
|
| 1623 |
+
* type of a layer conforms to a specific type constraint.
|
| 1624 |
+
*
|
| 1625 |
+
* **Example** (Constraining layer error types)
|
| 1626 |
*
|
|
|
|
| 1627 |
* ```ts
|
| 1628 |
* import { Layer } from "effect"
|
| 1629 |
*
|
|
|
|
| 1643 |
* // Type 'string' is not assignable to type 'Error'
|
| 1644 |
* ```
|
| 1645 |
*
|
| 1646 |
+
* @category utility types
|
| 1647 |
* @since 4.0.0
|
|
|
|
| 1648 |
*/
|
| 1649 |
export const satisfiesErrorType = () => layer => layer;
|
| 1650 |
/**
|
| 1651 |
+
* Ensures that a layer's requirements type extends a given type `R`.
|
| 1652 |
+
*
|
| 1653 |
+
* **Details**
|
| 1654 |
*
|
| 1655 |
* This function provides compile-time type checking to ensure that the
|
| 1656 |
+
* requirements type of a layer conforms to a specific type constraint.
|
| 1657 |
+
*
|
| 1658 |
+
* **Example** (Constraining layer service requirements)
|
| 1659 |
*
|
|
|
|
| 1660 |
* ```ts
|
| 1661 |
* import { Layer } from "effect"
|
| 1662 |
*
|
| 1663 |
* declare const FortyTwoLayer: Layer.Layer<never, never, 42>
|
| 1664 |
* declare const StringLayer: Layer.Layer<never, never, string>
|
| 1665 |
*
|
| 1666 |
+
* // Define a constraint that the service requirements must be numbers
|
| 1667 |
* const satisfiesNumber = Layer.satisfiesServicesType<number>()
|
| 1668 |
*
|
| 1669 |
* // This works - Layer<never, never, 42> extends Layer<never, never, number>
|
|
|
|
| 1675 |
* // Type 'string' is not assignable to type 'number'
|
| 1676 |
* ```
|
| 1677 |
*
|
| 1678 |
+
* @category utility types
|
| 1679 |
* @since 4.0.0
|
|
|
|
| 1680 |
*/
|
| 1681 |
export const satisfiesServicesType = () => layer => layer;
|
| 1682 |
/**
|
| 1683 |
* Constructs a new `Layer` which creates a span and registers it as the current
|
| 1684 |
* parent span.
|
| 1685 |
*
|
| 1686 |
+
* **Details**
|
| 1687 |
+
*
|
| 1688 |
* This allows you to create a traced scope for layer construction, making all
|
| 1689 |
* operations within the layer constructor part of the same trace span. The span
|
| 1690 |
+
* is automatically ended when the layer's scope is closed. If `onEnd` is
|
| 1691 |
+
* provided, it receives the span and the layer scope's exit value when the span
|
| 1692 |
+
* ends.
|
| 1693 |
+
*
|
| 1694 |
+
* **Example** (Tracing layer construction with a span)
|
| 1695 |
*
|
|
|
|
| 1696 |
* ```ts
|
| 1697 |
+
* import { Console, Context, Effect, Layer } from "effect"
|
| 1698 |
+
* import type { Tracer } from "effect"
|
| 1699 |
*
|
| 1700 |
* class Database extends Context.Service<Database, {
|
| 1701 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 1727 |
* })
|
| 1728 |
* ```
|
| 1729 |
*
|
|
|
|
| 1730 |
* @category tracing
|
| 1731 |
+
* @since 2.0.0
|
| 1732 |
*/
|
| 1733 |
export const span = (name, options) => {
|
| 1734 |
options = internalTracer.addSpanStackTrace(options);
|
| 1735 |
return effect(Tracer.ParentSpan, options?.onEnd ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options));
|
| 1736 |
};
|
| 1737 |
/**
|
| 1738 |
+
* Constructs a layer that provides an existing span as the current parent span.
|
|
|
|
| 1739 |
*
|
| 1740 |
+
* **Details**
|
| 1741 |
+
*
|
| 1742 |
+
* The supplied span is made available through `Tracer.ParentSpan` for layers
|
| 1743 |
+
* that are built with this layer. This API does not create, end, or close the
|
| 1744 |
+
* span; the caller remains responsible for the span's lifetime.
|
| 1745 |
+
*
|
| 1746 |
+
* **Example** (Using an existing parent span)
|
| 1747 |
*
|
|
|
|
| 1748 |
* ```ts
|
| 1749 |
+
* import { Console, Context, Effect, Layer, Tracer } from "effect"
|
| 1750 |
*
|
| 1751 |
* class Database extends Context.Service<Database, {
|
| 1752 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 1771 |
* }))))
|
| 1772 |
* ```
|
| 1773 |
*
|
|
|
|
| 1774 |
* @category tracing
|
| 1775 |
+
* @since 2.0.0
|
| 1776 |
*/
|
| 1777 |
export const parentSpan = span => succeedContext(Tracer.ParentSpan.context(span));
|
| 1778 |
/**
|
| 1779 |
+
* Wraps a `Layer` with a new tracing span, making all operations in the layer
|
| 1780 |
* constructor part of the named trace span.
|
| 1781 |
*
|
| 1782 |
+
* **Details**
|
| 1783 |
+
*
|
| 1784 |
* This creates a new span for the layer's construction and execution. The span
|
| 1785 |
* is automatically ended when the layer's scope is closed. This is useful for
|
| 1786 |
* tracking the lifecycle and performance of layer initialization.
|
| 1787 |
*
|
| 1788 |
+
* **Example** (Wrapping a layer with a span)
|
| 1789 |
+
*
|
| 1790 |
* ```ts
|
| 1791 |
+
* import { Context, Effect, Layer } from "effect"
|
| 1792 |
*
|
| 1793 |
* class Database extends Context.Service<Database, {
|
| 1794 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 1829 |
*
|
| 1830 |
* yield* logger.log("Application ready")
|
| 1831 |
* return yield* database.query("SELECT * FROM users")
|
| 1832 |
+
* }).pipe(Effect.provide(appLayer))
|
|
|
|
| 1833 |
* ```
|
| 1834 |
*
|
|
|
|
| 1835 |
* @category tracing
|
| 1836 |
+
* @since 2.0.0
|
| 1837 |
*/
|
| 1838 |
export const withSpan = function () {
|
| 1839 |
const dataFirst = typeof arguments[0] !== "string";
|
|
|
|
| 1846 |
return self => unwrap(internalEffect.map(options?.onEnd !== undefined ? internalEffect.tap(internalEffect.makeSpanScoped(name, options), span => internalEffect.addFinalizer(exit => options.onEnd(span, exit))) : internalEffect.makeSpanScoped(name, options), span => withParentSpan(self, span)));
|
| 1847 |
};
|
| 1848 |
/**
|
| 1849 |
+
* Wraps a layer so spans created during its construction use the supplied span
|
| 1850 |
+
* as their parent.
|
| 1851 |
+
*
|
| 1852 |
+
* **Details**
|
| 1853 |
+
*
|
| 1854 |
+
* Use this to attach layer construction to an existing trace hierarchy. This API
|
| 1855 |
+
* does not create or end the supplied parent span.
|
| 1856 |
+
*
|
| 1857 |
+
* When the supplied span is a native `Span`, layer construction also receives
|
| 1858 |
+
* diagnostic information that helps associate failures with the layer call site.
|
| 1859 |
+
* External spans are only installed as the parent span and do not add this
|
| 1860 |
+
* diagnostic call-site information.
|
| 1861 |
*
|
| 1862 |
+
* **Example** (Attaching layers to an existing parent span)
|
|
|
|
|
|
|
| 1863 |
*
|
|
|
|
| 1864 |
* ```ts
|
| 1865 |
+
* import { Context, Effect, Layer, Tracer } from "effect"
|
| 1866 |
*
|
| 1867 |
* class Database extends Context.Service<Database, {
|
| 1868 |
* readonly query: (sql: string) => Effect.Effect<string>
|
|
|
|
| 1909 |
* )
|
| 1910 |
* ```
|
| 1911 |
*
|
|
|
|
| 1912 |
* @category tracing
|
| 1913 |
+
* @since 2.0.0
|
| 1914 |
*/
|
| 1915 |
export const withParentSpan = function () {
|
| 1916 |
const dataFirst = isLayer(arguments[0]);
|
.opencode/node_modules/effect/dist/Layer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"version":3,"file":"Layer.js","names":["Context","Deferred","constant","constTrue","constUndefined","dual","identity","core","internalEffect","internalTracer","pipeArguments","hasProperty","CurrentStackFrame","Scope","Tracer","TypeId","MemoMapTypeId","isLayer","u","LayerProto","_ROut","_E","_RIn","pipe","arguments","fromBuildUnsafe","build","self","Object","create","fromBuild","memoMap","scope","layerScope","forkUnsafe","onExit","exit","_tag","close","void","fromBuildMemo","getOrElseMemoize","MemoMapImpl","map","Map","layer","has","entry","get","observers","andThen","scopeAddFinalizerExit","finalizer","effect","makeUnsafe","deferred","await","suspend","delete","set","flatMap","done","makeMemoMapUnsafe","makeMemoMap","sync","CurrentMemoMap","Service","getOrCreate","getOrElse","buildWithMemoMap","provideService","add","withFiber","fiber","context","getUnsafe","buildWithScope","succeed","length","resource","succeedContext","make","empty","evaluate","syncContext","effectImpl","service","effectContext","value","_","provide","effectDiscard","as","unwrap","mergeAllEffect","layers","parentScope","forEach","concurrency","mergeAll","merge","that","Array","isArray","provideWith","f","provideContext","merged","provideMerge","tap","tapError","catch_","error","fail","tapCause","catchCause","cause","failCause","orDie","onError","e","catch","catchTag","k","updateService","asEffect","fresh","launch","scoped","never","mock","implementation","mockImpl","Proxy","target","prop","_receiver","prevLimit","Error","stackTraceLimit","key","toString","name","makeUnimplemented","dead","assign","die","StreamTypeId","channel","ChannelTypeId","transform","unimplemented","setPrototypeOf","getPrototypeOf","satisfiesSuccessType","satisfiesErrorType","satisfiesServicesType","span","options","addSpanStackTrace","ParentSpan","onEnd","makeSpanScoped","addFinalizer","parentSpan","withSpan","dataFirst","undefined","withParentSpan","provideStackFrame","provideSpanStackFrame","captureStackTrace","parentSpanLayer","stack","parent"],"sources":["../src/Layer.ts"],"sourcesContent":[null],"mappings":"AAsBA,OAAO,KAAKA,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAIzC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,cAAc,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,eAAe;AACnF,OAAO,KAAKC,IAAI,MAAM,oBAAoB;AAC1C,OAAO,KAAKC,cAAc,MAAM,sBAAsB;AAEtD,OAAO,KAAKC,cAAc,MAAM,sBAAsB;AACtD,SAAwBC,aAAa,QAAQ,eAAe;AAC5D,SAASC,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,OAAO,KAAKC,KAAK,MAAM,YAAY;AAEnC,OAAO,KAAKC,MAAM,MAAM,aAAa;AAIrC,MAAMC,MAAM,GAAG,eAAe;AA6F9B,MAAMC,aAAa,GAAG,uBAAuB;AA0C7C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;;;;;AA2DA,OAAO,MAAMW,cAAc,GA2HvB,SAAAA,CAAA;EACF,MAAMF,SAAS,GAAGrJ,OAAO,CAACO,SAAS,CAAC,CAAC,CAAC,CAAC;EACvC,MAAMqI,IAAI,GAAmBS,SAAS,GAAG9I,SAAS,CAAC,CAAC,CAAC,GAAGA,SAAS,CAAC,CAAC,CAAC;EACpE,IAAIsI,OAAO,GAAGQ,SAAS,GAAG9I,SAAS,CAAC,CAAC,CAAC,GAAGA,SAAS,CAAC,CAAC,CAAC;EACrD,IAAIiJ,iBAAiB,GAAsDnK,QAAQ;EACnF,IAAIuJ,IAAI,CAACxH,IAAI,KAAK,MAAM,EAAE;IACxByH,OAAO,GAAGrJ,cAAc,CAACsJ,iBAAiB,CAACD,OAAO,CAAC;IACnDW,iBAAiB,GAAGC,qBAAqB,CAACb,IAAI,CAACf,IAAI,EAAEgB,OAAO,EAAEa,iBAAiB,CAAC;EAClF;EACA,MAAMC,eAAe,GAAGR,UAAU,CAACP,IAAI,CAAC;EACxC,IAAIS,SAAS,EAAE;IACb,OAAO5E,OAAO,CAAC+E,iBAAiB,CAACjJ,SAAS,CAAC,CAAC,CAAC,CAAC,EAAEoJ,eAAe,CAAC;EAClE;EACA,OAAQjJ,IAA0B,IAAK+D,OAAO,CAAC+E,iBAAiB,CAAC9I,IAAI,CAAC,EAAEiJ,eAAe,CAAC;AAC1F,CAAQ;AAER,MAAMF,qBAAqB,GAAGA,CAAC5B,IAAY,EAAE+B,KAA6C,KAAI;EAC5FA,KAAK,GAAG,OAAOA,KAAK,KAAK,UAAU,GAAGA,KAAK,GAAGzK,cAAc;EAC5D,OAAOwH,aAAa,CAAChH,iBAAiB,EAAGkK,MAAM,KAAM;IACnDhC,IAAI;IACJ+B,KAAK;IACLC;GACD,CAAC,CAAC;AACL,CAAC","ignoreList":[]}
|
|
|
|
| 1 |
+
{"version":3,"file":"Layer.js","names":["Context","Deferred","constant","constTrue","constUndefined","dual","identity","core","internalEffect","internalTracer","pipeArguments","hasProperty","CurrentStackFrame","Scope","Tracer","TypeId","MemoMapTypeId","memoMapReuse","entry","scope","observers","andThen","scopeAddFinalizerExit","exit","finalizer","effect","isLayer","u","LayerProto","_ROut","_E","_RIn","pipe","arguments","fromBuildUnsafe","build","self","Object","create","fromBuild","memoMap","layerScope","forkUnsafe","onExit","_tag","close","void","fromBuildMemo","getOrElseMemoize","memoMapBuild","layer","makeUnsafe","deferred","await","suspend","map","delete","set","flatMap","done","MemoMapImpl","parent","constructor","Map","get","local","existing","makeMemoMapUnsafe","forkMemoMapUnsafe","makeMemoMap","sync","forkMemoMap","CurrentMemoMap","Service","getOrCreate","getOrElse","buildWithMemoMap","provideService","add","withFiber","fiber","context","getUnsafe","buildWithScope","succeed","length","resource","succeedContext","make","empty","evaluate","syncContext","effectImpl","service","effectContext","value","_","provide","effectDiscard","as","unwrap","mergeAllEffect","layers","parentScope","forEach","concurrency","mergeAll","merge","that","Array","isArray","provideWith","f","provideContext","merged","provideMerge","tap","tapError","catch_","error","fail","tapCause","catchCause","cause","failCause","orDie","onError","e","catch","catchTag","k","updateService","fresh","launch","scoped","never","mock","implementation","mockImpl","Proxy","target","prop","_receiver","prevLimit","Error","stackTraceLimit","key","toString","name","makeUnimplemented","has","dead","assign","die","StreamTypeId","channel","ChannelTypeId","transform","unimplemented","setPrototypeOf","getPrototypeOf","satisfiesSuccessType","satisfiesErrorType","satisfiesServicesType","span","options","addSpanStackTrace","ParentSpan","onEnd","makeSpanScoped","addFinalizer","parentSpan","withSpan","dataFirst","undefined","withParentSpan","provideStackFrame","provideSpanStackFrame","captureStackTrace","parentSpanLayer","stack"],"sources":["../src/Layer.ts"],"sourcesContent":[null],"mappings":"AAcA,OAAO,KAAKA,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AAIzC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,cAAc,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,eAAe;AACnF,OAAO,KAAKC,IAAI,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AOA,KAAK,KAAK,UAAU,GAAGA,KAAK,GAAGhL,cAAc;EAC5D,OAAO+H,aAAa,CAACvH,iBAAiB,EAAGiD,MAAM,KAAM;IACnDuF,IAAI;IACJgC,KAAK;IACLvH;GACD,CAAC,CAAC;AACL,CAAC","ignoreList":[]}
|
.opencode/node_modules/effect/dist/LayerMap.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
| 1 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
* @since 3.14.0
|
| 3 |
*/
|
| 4 |
import * as Context from "./Context.ts";
|
|
@@ -11,11 +19,17 @@ import type { NoExcessProperties } from "./Types.ts";
|
|
| 11 |
declare const TypeId = "~effect/LayerMap";
|
| 12 |
type IdleTimeToLiveInput<K> = Duration.Input | ((key: K) => Duration.Input);
|
| 13 |
/**
|
| 14 |
-
*
|
| 15 |
-
*
|
| 16 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
* ```ts
|
| 18 |
-
* import { Effect, Layer, LayerMap
|
| 19 |
*
|
| 20 |
* // Define a service key
|
| 21 |
* const DatabaseService = Context.Service<{
|
|
@@ -43,6 +57,9 @@ type IdleTimeToLiveInput<K> = Duration.Input | ((key: K) => Duration.Input);
|
|
| 43 |
* yield* layerMap.invalidate("development")
|
| 44 |
* })
|
| 45 |
* ```
|
|
|
|
|
|
|
|
|
|
| 46 |
*/
|
| 47 |
export interface LayerMap<in out K, in out I, in out E = never> {
|
| 48 |
readonly [TypeId]: typeof TypeId;
|
|
@@ -64,15 +81,12 @@ export interface LayerMap<in out K, in out I, in out E = never> {
|
|
| 64 |
invalidate(key: K): Effect.Effect<void>;
|
| 65 |
}
|
| 66 |
/**
|
| 67 |
-
*
|
| 68 |
-
* @category Constructors
|
| 69 |
*
|
| 70 |
-
*
|
| 71 |
-
* dynamically access resources based on a key.
|
| 72 |
*
|
| 73 |
-
* @example
|
| 74 |
* ```ts
|
| 75 |
-
* import { Effect, Layer, LayerMap
|
| 76 |
*
|
| 77 |
* // Define a service key
|
| 78 |
* const DatabaseService = Context.Service<{
|
|
@@ -104,17 +118,26 @@ export interface LayerMap<in out K, in out I, in out E = never> {
|
|
| 104 |
* console.log(result) // "development: SELECT * FROM users"
|
| 105 |
* })
|
| 106 |
* ```
|
|
|
|
|
|
|
|
|
|
| 107 |
*/
|
| 108 |
export declare const make: <K, L extends Layer.Layer<any, any, any>, PreloadKeys extends Iterable<K> | undefined = undefined>(lookup: (key: K) => L, options?: {
|
| 109 |
readonly idleTimeToLive?: IdleTimeToLiveInput<K> | undefined;
|
| 110 |
readonly preloadKeys?: PreloadKeys;
|
| 111 |
} | undefined) => Effect.Effect<LayerMap<K, Layer.Success<L>, Layer.Error<L>>, PreloadKeys extends undefined ? never : Layer.Error<L>, Scope.Scope | Layer.Services<L>>;
|
| 112 |
/**
|
| 113 |
-
*
|
| 114 |
-
*
|
| 115 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
* ```ts
|
| 117 |
-
* import { Effect, Layer, LayerMap
|
| 118 |
*
|
| 119 |
* // Define service keys
|
| 120 |
* const DevDatabase = Context.Service<{
|
|
@@ -148,14 +171,32 @@ export declare const make: <K, L extends Layer.Layer<any, any, any>, PreloadKeys
|
|
| 148 |
* console.log("LayerMap created from record")
|
| 149 |
* })
|
| 150 |
* ```
|
|
|
|
|
|
|
|
|
|
| 151 |
*/
|
| 152 |
export declare const fromRecord: <const Layers extends Record<string, Layer.Layer<any, any, any>>, const Preload extends boolean = false>(layers: Layers, options?: {
|
| 153 |
readonly idleTimeToLive?: IdleTimeToLiveInput<keyof Layers> | undefined;
|
| 154 |
readonly preload?: Preload | undefined;
|
| 155 |
} | undefined) => Effect.Effect<LayerMap<keyof Layers, Layer.Success<Layers[keyof Layers]>, Layer.Error<Layers[keyof Layers]>>, Preload extends true ? Layer.Error<Layers[keyof Layers]> : never, Scope.Scope | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)>;
|
| 156 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
* @since 3.14.0
|
| 158 |
-
* @category Service
|
| 159 |
*/
|
| 160 |
export interface TagClass<in out Self, in out Id extends string, in out K, in out I, in out E, in out R, in out LE, in out Deps extends Layer.Layer<any, any, any>> extends Context.ServiceClass<Self, Id, LayerMap<K, I, E>> {
|
| 161 |
/**
|
|
@@ -180,15 +221,13 @@ export interface TagClass<in out Self, in out Id extends string, in out K, in ou
|
|
| 180 |
readonly invalidate: (key: K) => Effect.Effect<void, never, Self>;
|
| 181 |
}
|
| 182 |
/**
|
| 183 |
-
* @since 3.14.0
|
| 184 |
-
* @category Service
|
| 185 |
-
*
|
| 186 |
* Create a `LayerMap` service that provides a dynamic set of resources based on
|
| 187 |
* a key.
|
| 188 |
*
|
| 189 |
-
*
|
|
|
|
| 190 |
* ```ts
|
| 191 |
-
* import { Console, Effect, Layer, LayerMap
|
| 192 |
*
|
| 193 |
* // Define a service key
|
| 194 |
* const Greeter = Context.Service<{
|
|
@@ -220,6 +259,9 @@ export interface TagClass<in out Self, in out Id extends string, in out K, in ou
|
|
| 220 |
* Effect.provide(GreeterMap.layer)
|
| 221 |
* )
|
| 222 |
* ```
|
|
|
|
|
|
|
|
|
|
| 223 |
*/
|
| 224 |
export declare const Service: <Self>() => <const Id extends string, const Options extends NoExcessProperties<{
|
| 225 |
readonly lookup: (key: any) => Layer.Layer<any, any, any>;
|
|
@@ -247,13 +289,16 @@ export declare const Service: <Self>() => <const Id extends string, const Option
|
|
| 247 |
readonly dependencies: ReadonlyArray<Layer.Layer<any, any, any>>;
|
| 248 |
} ? Options["dependencies"][number] : never>;
|
| 249 |
/**
|
|
|
|
|
|
|
| 250 |
* @since 3.14.0
|
| 251 |
-
* @category Service
|
| 252 |
*/
|
| 253 |
export declare namespace Service {
|
| 254 |
/**
|
|
|
|
|
|
|
|
|
|
| 255 |
* @since 3.14.0
|
| 256 |
-
* @category Service
|
| 257 |
*/
|
| 258 |
type Key<Options> = Options extends {
|
| 259 |
readonly lookup: (key: infer K) => any;
|
|
@@ -261,8 +306,10 @@ export declare namespace Service {
|
|
| 261 |
readonly layers: infer Layers;
|
| 262 |
} ? keyof Layers : never;
|
| 263 |
/**
|
|
|
|
|
|
|
|
|
|
| 264 |
* @since 3.14.0
|
| 265 |
-
* @category Service
|
| 266 |
*/
|
| 267 |
type Layers<Options> = Options extends {
|
| 268 |
readonly lookup: (key: infer _K) => infer Layers;
|
|
@@ -270,18 +317,26 @@ export declare namespace Service {
|
|
| 270 |
readonly layers: infer Layers;
|
| 271 |
} ? Layers[keyof Layers] : never;
|
| 272 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
* @since 3.14.0
|
| 274 |
-
* @category Service
|
| 275 |
*/
|
| 276 |
type Success<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _A : never;
|
| 277 |
/**
|
|
|
|
|
|
|
|
|
|
| 278 |
* @since 3.14.0
|
| 279 |
-
* @category Service
|
| 280 |
*/
|
| 281 |
type Error<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never;
|
| 282 |
/**
|
| 283 |
-
*
|
| 284 |
-
*
|
|
|
|
|
|
|
|
|
|
| 285 |
*/
|
| 286 |
type Services<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never;
|
| 287 |
}
|
|
|
|
| 1 |
/**
|
| 2 |
+
* Caches scoped services selected by key and built from layers.
|
| 3 |
+
*
|
| 4 |
+
* A `LayerMap<K, I, E>` turns a key into a cached service `Context<I>` and
|
| 5 |
+
* exposes that context as either a `Layer` or a scoped effect. Entries can be
|
| 6 |
+
* invalidated explicitly or released after they sit unused. This is useful for
|
| 7 |
+
* keyed resource families such as tenant clients, regional connections, or
|
| 8 |
+
* environment-specific services.
|
| 9 |
+
*
|
| 10 |
* @since 3.14.0
|
| 11 |
*/
|
| 12 |
import * as Context from "./Context.ts";
|
|
|
|
| 19 |
declare const TypeId = "~effect/LayerMap";
|
| 20 |
type IdleTimeToLiveInput<K> = Duration.Input | ((key: K) => Duration.Input);
|
| 21 |
/**
|
| 22 |
+
* A scoped, keyed map of layer-built service contexts.
|
| 23 |
+
*
|
| 24 |
+
* **Details**
|
| 25 |
+
*
|
| 26 |
+
* A `LayerMap` builds resources for a key on demand, exposes them as a `Layer`
|
| 27 |
+
* or scoped `Context`, and can invalidate cached resources for a key.
|
| 28 |
+
*
|
| 29 |
+
* **Example** (Managing keyed layers)
|
| 30 |
+
*
|
| 31 |
* ```ts
|
| 32 |
+
* import { Context, Effect, Layer, LayerMap } from "effect"
|
| 33 |
*
|
| 34 |
* // Define a service key
|
| 35 |
* const DatabaseService = Context.Service<{
|
|
|
|
| 57 |
* yield* layerMap.invalidate("development")
|
| 58 |
* })
|
| 59 |
* ```
|
| 60 |
+
*
|
| 61 |
+
* @category models
|
| 62 |
+
* @since 3.14.0
|
| 63 |
*/
|
| 64 |
export interface LayerMap<in out K, in out I, in out E = never> {
|
| 65 |
readonly [TypeId]: typeof TypeId;
|
|
|
|
| 81 |
invalidate(key: K): Effect.Effect<void>;
|
| 82 |
}
|
| 83 |
/**
|
| 84 |
+
* Creates a `LayerMap` that dynamically provides resources based on a key.
|
|
|
|
| 85 |
*
|
| 86 |
+
* **Example** (Creating a layer map)
|
|
|
|
| 87 |
*
|
|
|
|
| 88 |
* ```ts
|
| 89 |
+
* import { Context, Effect, Layer, LayerMap } from "effect"
|
| 90 |
*
|
| 91 |
* // Define a service key
|
| 92 |
* const DatabaseService = Context.Service<{
|
|
|
|
| 118 |
* console.log(result) // "development: SELECT * FROM users"
|
| 119 |
* })
|
| 120 |
* ```
|
| 121 |
+
*
|
| 122 |
+
* @category constructors
|
| 123 |
+
* @since 3.14.0
|
| 124 |
*/
|
| 125 |
export declare const make: <K, L extends Layer.Layer<any, any, any>, PreloadKeys extends Iterable<K> | undefined = undefined>(lookup: (key: K) => L, options?: {
|
| 126 |
readonly idleTimeToLive?: IdleTimeToLiveInput<K> | undefined;
|
| 127 |
readonly preloadKeys?: PreloadKeys;
|
| 128 |
} | undefined) => Effect.Effect<LayerMap<K, Layer.Success<L>, Layer.Error<L>>, PreloadKeys extends undefined ? never : Layer.Error<L>, Scope.Scope | Layer.Services<L>>;
|
| 129 |
/**
|
| 130 |
+
* Creates a `LayerMap` from a record of predefined layers.
|
| 131 |
+
*
|
| 132 |
+
* **Details**
|
| 133 |
+
*
|
| 134 |
+
* The record keys become the keys accepted by the returned `LayerMap`, and the
|
| 135 |
+
* record values are the layers built for those keys.
|
| 136 |
+
*
|
| 137 |
+
* **Example** (Creating a layer map from a record)
|
| 138 |
+
*
|
| 139 |
* ```ts
|
| 140 |
+
* import { Context, Effect, Layer, LayerMap } from "effect"
|
| 141 |
*
|
| 142 |
* // Define service keys
|
| 143 |
* const DevDatabase = Context.Service<{
|
|
|
|
| 171 |
* console.log("LayerMap created from record")
|
| 172 |
* })
|
| 173 |
* ```
|
| 174 |
+
*
|
| 175 |
+
* @category constructors
|
| 176 |
+
* @since 3.14.0
|
| 177 |
*/
|
| 178 |
export declare const fromRecord: <const Layers extends Record<string, Layer.Layer<any, any, any>>, const Preload extends boolean = false>(layers: Layers, options?: {
|
| 179 |
readonly idleTimeToLive?: IdleTimeToLiveInput<keyof Layers> | undefined;
|
| 180 |
readonly preload?: Preload | undefined;
|
| 181 |
} | undefined) => Effect.Effect<LayerMap<keyof Layers, Layer.Success<Layers[keyof Layers]>, Layer.Error<Layers[keyof Layers]>>, Preload extends true ? Layer.Error<Layers[keyof Layers]> : never, Scope.Scope | (Layers[keyof Layers] extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)>;
|
| 182 |
/**
|
| 183 |
+
* Service class shape produced by `LayerMap.Service`.
|
| 184 |
+
*
|
| 185 |
+
* **When to use**
|
| 186 |
+
*
|
| 187 |
+
* Use as the public type for classes returned by `LayerMap.Service` when an API
|
| 188 |
+
* needs to accept, return, or alias the generated service class and its static
|
| 189 |
+
* helpers.
|
| 190 |
+
*
|
| 191 |
+
* **Details**
|
| 192 |
+
*
|
| 193 |
+
* It combines a `Context.Service` tag for the `LayerMap` with default layers
|
| 194 |
+
* and helper accessors for retrieving, using, and invalidating keyed resources.
|
| 195 |
+
*
|
| 196 |
+
* @see {@link Service} for creating concrete `LayerMap` service classes
|
| 197 |
+
*
|
| 198 |
+
* @category services
|
| 199 |
* @since 3.14.0
|
|
|
|
| 200 |
*/
|
| 201 |
export interface TagClass<in out Self, in out Id extends string, in out K, in out I, in out E, in out R, in out LE, in out Deps extends Layer.Layer<any, any, any>> extends Context.ServiceClass<Self, Id, LayerMap<K, I, E>> {
|
| 202 |
/**
|
|
|
|
| 221 |
readonly invalidate: (key: K) => Effect.Effect<void, never, Self>;
|
| 222 |
}
|
| 223 |
/**
|
|
|
|
|
|
|
|
|
|
| 224 |
* Create a `LayerMap` service that provides a dynamic set of resources based on
|
| 225 |
* a key.
|
| 226 |
*
|
| 227 |
+
* **Example** (Defining a layer map service)
|
| 228 |
+
*
|
| 229 |
* ```ts
|
| 230 |
+
* import { Console, Context, Effect, Layer, LayerMap } from "effect"
|
| 231 |
*
|
| 232 |
* // Define a service key
|
| 233 |
* const Greeter = Context.Service<{
|
|
|
|
| 259 |
* Effect.provide(GreeterMap.layer)
|
| 260 |
* )
|
| 261 |
* ```
|
| 262 |
+
*
|
| 263 |
+
* @category services
|
| 264 |
+
* @since 3.14.0
|
| 265 |
*/
|
| 266 |
export declare const Service: <Self>() => <const Id extends string, const Options extends NoExcessProperties<{
|
| 267 |
readonly lookup: (key: any) => Layer.Layer<any, any, any>;
|
|
|
|
| 289 |
readonly dependencies: ReadonlyArray<Layer.Layer<any, any, any>>;
|
| 290 |
} ? Options["dependencies"][number] : never>;
|
| 291 |
/**
|
| 292 |
+
* Type helpers for values created with `LayerMap.Service`.
|
| 293 |
+
*
|
| 294 |
* @since 3.14.0
|
|
|
|
| 295 |
*/
|
| 296 |
export declare namespace Service {
|
| 297 |
/**
|
| 298 |
+
* Extracts the key type accepted by a `LayerMap.Service` definition.
|
| 299 |
+
*
|
| 300 |
+
* @category services
|
| 301 |
* @since 3.14.0
|
|
|
|
| 302 |
*/
|
| 303 |
type Key<Options> = Options extends {
|
| 304 |
readonly lookup: (key: infer K) => any;
|
|
|
|
| 306 |
readonly layers: infer Layers;
|
| 307 |
} ? keyof Layers : never;
|
| 308 |
/**
|
| 309 |
+
* Extracts the layer type produced by a `LayerMap.Service` definition.
|
| 310 |
+
*
|
| 311 |
+
* @category services
|
| 312 |
* @since 3.14.0
|
|
|
|
| 313 |
*/
|
| 314 |
type Layers<Options> = Options extends {
|
| 315 |
readonly lookup: (key: infer _K) => infer Layers;
|
|
|
|
| 317 |
readonly layers: infer Layers;
|
| 318 |
} ? Layers[keyof Layers] : never;
|
| 319 |
/**
|
| 320 |
+
* Extracts the services provided by the layers in a `LayerMap.Service`
|
| 321 |
+
* definition.
|
| 322 |
+
*
|
| 323 |
+
* @category services
|
| 324 |
* @since 3.14.0
|
|
|
|
| 325 |
*/
|
| 326 |
type Success<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _A : never;
|
| 327 |
/**
|
| 328 |
+
* Extracts the error type of the layers in a `LayerMap.Service` definition.
|
| 329 |
+
*
|
| 330 |
+
* @category services
|
| 331 |
* @since 3.14.0
|
|
|
|
| 332 |
*/
|
| 333 |
type Error<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never;
|
| 334 |
/**
|
| 335 |
+
* Extracts the service requirements of the layers in a `LayerMap.Service`
|
| 336 |
+
* definition.
|
| 337 |
+
*
|
| 338 |
+
* @category services
|
| 339 |
+
* @since 4.0.0
|
| 340 |
*/
|
| 341 |
type Services<Options> = Layers<Options> extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never;
|
| 342 |
}
|