@mark1russell7/collections 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/layers.d.ts CHANGED
@@ -24,7 +24,9 @@ type InnerOf<L> = L extends ((next: infer I) => any) ? I : never;
24
24
  type OuterOf<L> = L extends ((next: any) => infer O) ? O : never;
25
25
  /**
26
26
  * This type checks each neighbor pair of a list of layers. The result of the inner neighbor must
27
- * fit the input of the outer neighbor. At the first bad pair, the compiler marks that argument.
27
+ * fit the input of the outer neighbor. A bad pair makes the compiler refuse the call. The compiler
28
+ * marks the first argument, not the bad pair. Its message shows the type that the first bad pair
29
+ * needs. At the place of the inner neighbor, it needs a layer that gives the input of the outer one.
28
30
  *
29
31
  * The type is tail recursive, so the compiler accepts a chain of 100 layers.
30
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"layers.d.ts","names":[],"sources":["../src/core/layers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAoBY,MAAM,aAAa,QAAQ,UAAU,MAAM,UAAU;;KAGrD,QAAQ,KAAK,YAAW,YAAY,aAAY;;KAGhD,QAAQ,KAAK,YAAW,oBAAoB,KAAI;;;;;;;KAQhD,MAAM,8BAA8B,iDAC9C,0BAA0B,SAAS,YAAY,MAC1C,QAAQ,aAAa,QAAQ,MAC5B,gBAAgB,MAAM,iBAAiB,MAAM,mBAChC,MAAM,GAAG,WAAW,QAAQ,QAAQ,kBACtC,SAAS;;;;;;KAOhB,SAAS,gCACnB,yBACK,GAAG,MAAM,MAAM,IAChB,0BAA0B,uBACxB,wCAAwC,SACrC,MAAM,QAAQ,UAAU,QAAQ,iBAEnC,0BAA0B,QACvB,MAAM,QAAQ,OAAO,QAAQ;;KAI5B,OAAO,8BAA8B,iBAC/C,0BAA0B,gBAAgB,QAAQ,OAAO,MAAM,MAAM,QAAQ,UAAU;;;;;KAM7E,QAAQ,gCAClB,wCAAwC,SACnC,MAAM,QAAQ,UAAU,OAAO,KAAK,QAAQ,QAC7C,SAAS;;;;;;;;;;;;;iBAcC,cAAc,mBAAmB,YAAY,QAAQ,IAAI,MAAM,KAAK,SAAS"}
1
+ {"version":3,"file":"layers.d.ts","names":[],"sources":["../src/core/layers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAoBY,MAAM,aAAa,QAAQ,UAAU,MAAM,UAAU;;KAGrD,QAAQ,KAAK,YAAW,YAAY,aAAY;;KAGhD,QAAQ,KAAK,YAAW,oBAAoB,KAAI;;;;;;;;;KAUhD,MAAM,8BAA8B,iDAC9C,0BAA0B,SAAS,YAAY,MAC1C,QAAQ,aAAa,QAAQ,MAC5B,gBAAgB,MAAM,iBAAiB,MAAM,mBAChC,MAAM,GAAG,WAAW,QAAQ,QAAQ,kBACtC,SAAS;;;;;;KAOhB,SAAS,gCACnB,yBACK,GAAG,MAAM,MAAM,IAChB,0BAA0B,uBACxB,wCAAwC,SACrC,MAAM,QAAQ,UAAU,QAAQ,iBAEnC,0BAA0B,QACvB,MAAM,QAAQ,OAAO,QAAQ;;KAI5B,OAAO,8BAA8B,iBAC/C,0BAA0B,gBAAgB,QAAQ,OAAO,MAAM,MAAM,QAAQ,UAAU;;;;;KAM7E,QAAQ,gCAClB,wCAAwC,SACnC,MAAM,QAAQ,UAAU,OAAO,KAAK,QAAQ,QAC7C,SAAS;;;;;;;;;;;;;iBAcC,cAAc,mBAAmB,YAAY,QAAQ,IAAI,MAAM,KAAK,SAAS"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/collections",
4
- "version": "0.7.0",
4
+ "version": "0.7.1",
5
5
  "description": "Collections with no dependencies: lists, maps, queues, a summary tree, channels, lazy operations and dependency graphs.",
6
6
  "keywords": [
7
7
  "collections",
@@ -71,6 +71,7 @@
71
71
  "@mark1russell7/rigor-bench": "^0.2.5",
72
72
  "@mark1russell7/rigor-generators": "^0.1.5",
73
73
  "@mark1russell7/rigor-statistics": "^0.1.8",
74
+ "@mark1russell7/rigor-testkit": "^0.1.0",
74
75
  "@types/node": "^26.6.5",
75
76
  "esbuild": "^0.28.2",
76
77
  "fast-check": "^4.10.2",
@@ -84,6 +84,30 @@ const MUTATING_METHODS = new Set([
84
84
  "compute",
85
85
  "merge",
86
86
  "putAll",
87
+
88
+ // Queue changes that give undefined on an empty queue (C27: a readonly view removed an element)
89
+ "pollOrUndefined",
90
+
91
+ // The internal changes of the structures of this package. TypeScript marks them private, but a call at run
92
+ // time reaches them. `readonly.test.ts` puts each method of each structure in the reads or in this list.
93
+ "ensureCapacity",
94
+ "trimToSize",
95
+ "grow",
96
+ "resize",
97
+ "removeAtOffset",
98
+ "unlinkNode",
99
+ "heapify",
100
+ "bubbleUp",
101
+ "bubbleDown",
102
+ "addToEnd",
103
+ "moveToEnd",
104
+ "removeFromBucket",
105
+ "removeFromList",
106
+ "deleteNode",
107
+ "fixAfterInsertion",
108
+ "fixAfterDeletion",
109
+ "rotateLeft",
110
+ "rotateRight",
87
111
  ]);
88
112
 
89
113
  /** Methods that return a view of the collection: the view is readonly too. */
@@ -28,7 +28,9 @@ export type OuterOf<L> = L extends (next: any) => infer O ? O : never;
28
28
 
29
29
  /**
30
30
  * This type checks each neighbor pair of a list of layers. The result of the inner neighbor must
31
- * fit the input of the outer neighbor. At the first bad pair, the compiler marks that argument.
31
+ * fit the input of the outer neighbor. A bad pair makes the compiler refuse the call. The compiler
32
+ * marks the first argument, not the bad pair. Its message shows the type that the first bad pair
33
+ * needs. At the place of the inner neighbor, it needs a layer that gives the input of the outer one.
32
34
  *
33
35
  * The type is tail recursive, so the compiler accepts a chain of 100 layers.
34
36
  */
@@ -71,9 +71,11 @@ function notify<T>(name: string, listener: ((arg: T) => void) | undefined, arg:
71
71
  * With `skipDependents` (the default), a node whose dependency failed or was skipped does not start. Its result has
72
72
  * `skipped: true` and an error that names those dependencies. A dependency outside the DAG does not count.
73
73
  *
74
- * `failFast` operates at level granularity. When a node in a level fails, each
75
- * node already in flight in that level continues to completion. No later level
76
- * starts. (There is no mid-level cancellation.)
74
+ * `failFast` operates on levels. When a node of a level fails, each node of that level continues to its end.
75
+ * This includes the nodes that did not start before the failure, when `concurrency` is less than the
76
+ * size of the level. No later level starts. The run does not cancel a node.
77
+ *
78
+ * A node that did not start (`skipped: true`) calls neither `onNodeStart` nor `onNodeComplete`.
77
79
  */
78
80
  export async function executeDAG<TNode extends DAGNode>(
79
81
  dag: DependencyDAG<TNode>,
package/src/dag/types.ts CHANGED
@@ -39,7 +39,10 @@ export interface DependencyDAG<TNode extends DAGNode = DAGNode> {
39
39
  export interface DAGExecutionOptions<TNode extends DAGNode = DAGNode> {
40
40
  /** Max parallel operations per level (default: 4) */
41
41
  concurrency?: number;
42
- /** When this value is true, the run stops on the first error. The default is true. */
42
+ /**
43
+ * When this value is true, no level starts after a level with a failure. The default is true.
44
+ * Each node of the level with the failure runs, also a node that did not start before the failure.
45
+ */
43
46
  failFast?: boolean;
44
47
  /**
45
48
  * When this value is true, a node whose dependency failed or was skipped does not start. Its result has `skipped: true`.
@@ -43,10 +43,9 @@ export interface ReadonlyList<T> extends ReadonlyCollection<T> {
43
43
  lastIndexOf(element: T, fromIndex?: number): number;
44
44
 
45
45
  /**
46
- * This method gives a view of the portion of this list between fromIndex (inclusive)
47
- * and toIndex (exclusive).
46
+ * This method gives a new list with the elements from fromIndex (inclusive) to toIndex (exclusive).
48
47
  *
49
- * Changes to the sublist are reflected in the original list.
48
+ * The new list is a copy, not a view. A change to one list does not change the other list.
50
49
  *
51
50
  * @param fromIndex Start index (inclusive)
52
51
  * @param toIndex End index (exclusive)
@@ -135,7 +134,8 @@ export interface List<T> extends ReadonlyList<T>, Collection<T> {
135
134
  reverse(): void;
136
135
 
137
136
  /**
138
- * This method gives a mutable sublist view.
137
+ * This method gives a new mutable list with the elements from fromIndex (inclusive) to toIndex (exclusive).
138
+ * The new list is a copy, not a view.
139
139
  *
140
140
  * @param fromIndex Start index (inclusive)
141
141
  * @param toIndex End index (exclusive)